A simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, and dynamic language.
Applications | Applets |
---|---|
loaded from local or network storage | downloaded from server as needed |
runs on platform directly | runs on client within browser |
usually larger | usually smaller |
unlimited file access | limited file access |
unlimited network access | limited network access |
entry point: main() method | entry point: extends java.applet.Applet class |
Traditional compiled programs
Stage 1 | Stage 2 | Stage 3 |
Compiler (Pentium) | Binary File (Pentium) |
|
Your Code void main() { |
Compiler (PowerPC) | Binary File (PowerPC) |
Compiler (SPARC) | Binary File (SPARC) |
Java Programs
Stage 1 | Stage 2 | Stage 3 | Stage 4 |
Java Compiler / javac (Pentium) |
Java Interpreter (Pentium) |
||
Java Code class Hello } |
Java Compiler / javac (PowerPC) |
Java Bytecode (Platform Independent) |
Java Interpreter (PowerPC) |
Java Compiler / javac (SPARC) |
Java Interpreter (SPARC) |
You can download the JDK for free from http://java.sun.com or install it from the CD that comes with the text book.
The JDK includes:
The JDK does not include:
The only pieces of the JDK that are needed to run Java code is the JVM and the libraries. The rest is for development only.
The CLASSPATH environment variable contains a list of directories, .zip files, and .jar files where Java classes are to be found. To display the CLASSPATH in Windows 95:
echo %CLASSPATH%
To change the CLASSPATH in Windows 95:
set CLASSPATH = c:\jdk\lib\classes.zip;c:\myclasses
Other operating systems/environments will have different methods of setting the CLASSPATH, but all with honor the notion of the CLASSPATH.
Most browsers can run Java applets. Some examples are Netscape Navigator and Microsoft Internet Explorer.
Integrated Development Environments (IDEs) contain the same types of tools as the JDK, but provide a graphical user interface and editor. Some examples are IBM Visual Age for Java, Symantec Cafe, and Microsoft Visual J++.
For the best documentation, get it online from:
http://www.javasoft.com/products/jdk/1.1/docs/
public class Week1 { public static void main (String[] args) { System.out.println ("Hello World"); } }
public class Week1Applet extends java.applet.Applet { public void paint (java.awt.Graphics g) { g.drawString ("Hello World", 5, 25); } }
<applet code=Week1Applet.class width=300 height=300> </applet>
drawString | public abstract void drawString(String str, int x, int y) Draws the text given by the specified string, using this graphics context's current font and color. The baseline of the first character is at position (x, y) in this graphics context's coordinate system. Parameters: str - the string to be drawn. x - the x coordinate. y - the y coordinate. |
Copyright 1996-2001 OpenLoop Computing. All rights reserved.