Application Architecture Using Java

aniseedsplashΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 2 μέρες)

308 εμφανίσεις

Application Architecture Using

Hong Li


Developed by a team led by James Gosling at Sun

Originally called Oak, designed in 1991

Renamed Java in 1995, redesigned for developing
Internet Application

featured, general
purpose programming

Java initially became attractive because Java
program can be run from a web browser. It is called

Java can also be used to develop application on the
server side. Called Java servlets or JavaServer

Characteristics of Java

Java is simple

Java is Object

Java is distributed. Distributed computing
involves several computers working
together on a network.

Java is Interpreted. Programs are compiled
into the Java Virtual Machine code called
bytecode. The bytecode is machine
independent and can run on any machine
that has a Java interpreter, which is part of
the Java Virtual Machine (JVM)

Specification, API, JDK and

The Java language specification is a
technical definition of the language that
includes syntax and semantics

API contains predefined classes and

Java 2 standard edition

Java 2 Enterprise Edition (server side

Java 2 Micro edition (mobile devices)

Java Development Toolkit

Sun releases each versions of J2SE with a Java
Development Toolkit (JDK)

JDK consists of a set of separate programs for
developing and testing Java program

Jbuilder by Borland (

NetBean open source by Sun(

Sun One, a comercial vrsion of NetBeans by Sun

Eclipse open source by IBM (

These tools provide an integrated development
environment (IDE) for rapidly developing Java

Application and Applet

A Java program can be written in
many ways.

Applications are standalone programs.
It can be executed from any computer
with a Java interpreter

Applets are special kind of Java
programs that can run directly from a
compatible Web Browser

A simple Java Program

Display message “Welcome to Java!”

// this application program prints Welcome to

// file name:

public class Welcome


public static void main(String [] args)


System.out.println(“Welcome to Java!”);



Class and methods

The class is essential Java construct. To program in
Java, you must understand classes and be able to
write and use them. A program is defined by using
one or more classes.

System.out is known as the standard output object.
println is a method in the object

Every Java application must have a user
main method that defines where the program
begins. The Java interpreter executes the
application by invoking the main method

Displaying text in a message
dialog box

// file name:

import javax.swing.JoptionPane;

public class WelcomeDialog


public static void main(String[] args)


“Welcome to Java!”,”Example





Creating project

>new Project

Give a name and select directory, then click next

Keep all setting for path, then click next

For simplicity, uncheck Enable source package
discovery and compilation

Click finish

Jbuilder continued

Create a Java program File
>new class

Give file name, check only public and generate
main method, uncheck others

Click OK

Compile a Java program


Execute a Java program

> using default