• No results found

Contents. Java - An Introduction. Java Milestones. Java and its Evolution

N/A
N/A
Protected

Academic year: 2021

Share "Contents. Java - An Introduction. Java Milestones. Java and its Evolution"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

Java and its Evolution

Rajkumar Buyya

Grid Computing and Distributed Systems Lab Dept. of Computer Science and Software

Engineering The University of Melbourne

http:/ / www.buyya.com

Contents

Java I ntroduction Java Features

How Java Differs from other OO languages

Java and the World Wide Web Java Environment

Build your first Java Program Summary and Reference

Java - An I ntroduction

Java - The new programming language developed by Sun Microsystems in 1991. Originally called Oak by James Gosling, one of the inventors of the Java Language.

Java -The name that survived a patent search

Java Authors: James , Arthur Van , and others

Java is really “C+ + -- + + “

Java I ntroduction

Originally created for consumer electronics (TV, VCR, Freeze, Washing Machine, Mobile Phone).

Java - CPU I ndependent language I nternet and Web was just emerging, so Sun turned it into a language of I nternet Programming.

I t allows you to publish a webpage with Java code in it.

Java Milestones

The World Wide Web appeared on the I nternet and transformed the text-based interface to a graphical rich environment. The team developed Web applets (time programs) that could run on all types of computers connected to the I nternet.

1993

The team demonstrated the application of their new language to control a list of home appliances using a hand held device.

1992

Explored possibility of using C+ + , with some updates announced a new language named “Oak”

1991

Sun decided to developed special software that could be used for electronic devices. A project called Green Project created and head by James Gosling.

1990

Development Year

Java Milestones

Java established itself it self as both 1. “the language for I nternet programming” 2. a general purpose OO language.

1996

A class libraries, Community effort and standardization, Enterprise Java, Clustering, etc..

1997-Oak was renamed to Java, as it did not survive “legal” registration. Many companies such as Netscape and Microsoft announced their support for Java 1995

The team developed a new Web browsed called “Hot Java” to locate and run Applets. HotJava gained instance success.

1994

Development Year

(2)

Sun white paper defines Java as:

Simple and Powerful Safe

Object Oriented Robust

Architecture Neutral and Portable I nterpreted and High Performance Threaded

Dynamic

Java Attributes

Familiar, Simple, Small

Compiled and I nterpreted

Platform-I ndependent and Portable

Object-Oriented

Robust and Secure

Distributed

Multithreaded and I nteractive

High Performance

Dynamic and Extensible

Java is Compiled and I nterpreted

Text Editor Compiler I nterpreter Programmer Source Code .java file Byte Code .class file Hardware and Operating System Notepad, emacs,vi javac java appletviewer netscape

Compiled Languages

Text Editor Compiler linker Programmer Source Code .c file Object Code .o file Notepad, emacs,vi gcc Executable Code a.out file

Total Platform I ndependence

JAVA COMPILER

JAVA COMPILER

JAVA BYTE CODE

JAVA BYTE CODE

JAVA INTERPRETER

JAVA INTERPRETER

Windows 95 Macintosh Solaris Windows NT (translator)

(same for all platforms)

(one for each different system)

Architecture Neutral & Portable

Java Compiler - Java source code (file with extension .java) to bytecode(file with extension .class)

Bytecode- an intermediate form, closer

to machine representation

A interpreter (virtual machine) on any target platform interprets the bytecode.

(3)

Architecture Neutral & Portable

Porting the java system to any new platform involves writing an interpreter.

The interpreter will figure out what the equivalent machine dependent code to run

Rich Class Environment

Core Classes la ngua ge Utilities Input/ Output Low-Level Networking

Abstra ct Gra phica l User Interface I nternet Classes

TCP/ IP Networking WWW a nd HTML Distributed Progra ms

How Does Java Compares to

C+ + and Other OO Languages

Overlap of C, C+ + , and Java

C C+ +

Java

Java better than C+ + ?

No Typedefs, Defines, or Preprocessor

No Global Variables No Goto statements No Pointers No Unsafe Structures No Multiple I nheritance No Operator Overloading No Automatic Coercions

No Fragile Data Types

Object Oriented Languages -A Comparison

Feature C++ Objective C

Ada Java

Encapsulation Yes Yes Yes Yes

Inheritance Yes Yes No Yes

Multiple Inherit. Yes Yes No No

Polymorphism Yes Yes Yes Yes

Binding (Early or Late) Both Both Early Late

Concurrency Poor Poor Difficult Yes

Garbage Collection No Yes No Yes

Genericity Yes No Yes Limited

(4)

Java I ntegrates

Power of Compiled Languages

and

Flexibility of I nterpreted

Languages

Java Applications

We can develop two types of Java programs:

Stand-alone applications

Web applications (applets)

Applications v/ s Applets

Different ways to run a Java executable are:

Applica tion-A sta nd-a lone progra m tha t ca n be invoked from comma nd line . A program tha t ha s a “ma inma in” method

Applet-A progra m embedded in a web pa ge , to be run when the page is browsed . A progra m tha t contains no “main” method

Applets v/ s Applications

Different ways to run a Java executable are

Applica tion-A sta nd-a lone progra m tha t ca n be invoked from comma nd line . A program tha t ha s a “ma inma in” method

Applet-A progra m embedded in a web pa ge , to be run when the page is browsed . A progra m tha t contains no “main” method

Application–Executed by the Java interpreter.

Applet- Java enabled web browser.

Java and World Wide Web

Turning the Web into an I nteractive and Application

Delivery Platform

What is World Wide Web ?

Web is an open-ended information retrieval system designed to be used in the I nternet wide distributed system.

I t contains Web pages (created using HTML) that provide both information and controls.

Unlike a menu driven system--where we are guided through a particular direction using a decision tree, the web system is open ended and we can navigate to a new document in any direction.

(5)

Web Structure of Information

Search/ Navigation

Web as a delivery Vehicle

Execution of Applets

Hello Hello Hello Java <app= “Hello”> 4 APPLET Development “hello.java” AT SUN.COM The Internet hello.class AT SUN’S WEB SERVER 2 3 1 5 Create Applet tag in HTML document Accessing from Unimelb.edu.au The browser creates a new window and a new thread and then runs the

code

Significance of downloading Applets

I nteractive WWW

Flashy animation instead of static web pages

Applets react to users input and dynamically change

Display of dynamic data

WWW with Java - more than a document publishing medium

http:/ / www.javasoft.com/ applets/ alpha/ applets / StockDemo/ standalone.html

Power of Java and the Web

Deliver applications, not just information Eliminate porting

Eliminate end-user installation Slash software distribution costs Reach millions of customers - instantly

Java Development Kit

javac - The Java Compiler

java - The Java Interpreter

jdb- The Java Debugger

appletviewer -Tool to run the applets javap - to print the Java bytecodes javaprof - Java profiler

javadoc - documentation generator

(6)

Java Environment

Java Development Kit

javac - The Java Compiler java - The Java I nterpreter jdb- The Java Debugger

appletviewer -Tool to run the applets

javap - to print the Java bytecodes

javaprof - Java profiler

javadoc - documentation generator

javah - creates C header files

Process of Building and Running Java

Programs

Text Editor

Java Source Code

javac

Java Class File

java Outout javadoc javah jdb HTML Files Header Files

Let us Try Out

Building your first Java Program

Hello I nternet

// hello.java: Hello Internet program class HelloInternet

{

public static void main(String args[]) {

System.out.println(“Hello Internet”); } }

Program Processing

Compilation # javac hello.java results in HelloInternet.cla ss Execution # java HelloInternet Hello Internet #

(7)

Simple Java Applet

/ /HelloWorld Applet

import java.applet.Applet;

public class HelloWorld extends Applet { public void paint(Graphics g) {

g.drawString (“Hello World !”,25, 25);

} }

Calling an Applet

< HTML>

< TI TLE> HELLO WORLD APPLET< / TITLE> < HEAD> THE HELLO WORLD APPLET< / HEAD> < APPLET CODE= HelloWorld.class width= 500

height= 500> < / APPLET> < / HTML>

Applet Execution

Using AppletView er

Using Brow ser

Java on my platform ?

Sun (SPARC) ftp:/ / java.sun.com

Sun(x86) ftp:/ / xm.com:/ pub/

I BM(Aix, OS/ 2)ftp:/ / ncc.hursley.ibm.com/ javainfo

DEC(Alpha OSF/ 1)

http:/ / www.gr.osf.org:8001/ projects/ web/ java/

SGI http:/ / liawww.epfl.ch/ ~ simon/ java/ irix-jdk.html

HP http:/ / www.gr.osf.org:8001/ projects/ web/ java

linux http:/ / www.blackdown.org

AT & T http:/ / www.gr.osf.org:8001/ projects/ web/ java

Windows 3.1 http:/ / www.alphaworks.ibm.com

Summary

Java has emerged as a general purpose OO language.

I t supports both stand alone and I nternet Applications.

Makes the Web I nteractive and medium for application delivery.

Provides an excellent set of Tools for Application Development.

Java is ubiquitous!

References

Chapter 2: “Java Evolution”,

Programming with Java by Balagurusamy, TMH, New Delhi, I ndia

Optional:

Chapter 1: “Mastering C+ + ” by V. Rajuk and R. Buyya, Tata McGraw Hill, New Delhi, I ndia.

References

Related documents

The point at which the resultant of lift forces acts is: A) the hub. B) the center of gravity. D) the center of pressure.. A) airflow velocity increasing downward having been

The VX Cycle offers a broad range of scales for the cost-effective production of LNG/CCNG, and the Cycle can be integrated with existing CNG stations, pipeline compressor stations

In this paper, we present projection sorting, an alternative to the traditional Verlet list algorithm for pairwise short-range force calculations, and show that it can be

year’s deferred taxes plus payment of deferred taxes for the two prior years UNLESS the owner transfers the 2b property into the Rural Preserves program, in which case no

Acutely exposed animals require calcium gluconate (IV) and oral magnesium hydroxide or milk to bind fluoride before absorption. In chronic exposure, control is difficult unless

There are many augmented reality (AR) applications avail- able that can be used to create educational contents for these mobile devices. This paper surveys the most popular

(B) the adsorption at a single site on the surface may involve multiple molecules at the same time.. (C) the mass of gas striking a given area of surface is proportional to the

The 1,590 framed sheets, strictly ordered, absorb a century’s worth of high and low culture: picture postcards, maps of army battles, textile samplers, magazine covers, and