Lecture 2 - The Java Software Development Kit

Lecture 2 - The Java Software Development Kit - public...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
The Java Software Development Kit (SDK) • Can be downloaded for free from the SUN website - http://java.sun.com/javase/ - Java 6.0 is the latest stable version • Contains these command line tools : - javac: the Java Compiler - java: the interpreter - appletviewer: bare-bones browser - javadoc: HTML documentation generator - jdb: debugger - javaprof: profiling tool - javap: disassembler, an uncompelled (turns it back into source code) • Contains a library of classes grouped into packages. Eg: - java.lang - java.applet - java.awt - java.net - etc • Can be used to create: - Applications with console I/O - GUI applications - Web page applets A Simple Application • File Hello.java: public class Hello {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public static void main(String args) { System.out.println(“Hello, world!”); } } • Compile with: javac Hello.java- Produces: Hello.class • Execute with: java Hello - Leave out the .class suffix! A Simple Applet • File Welcome.java: import java.awt.Graphics; import java.applet.Applet; public class Welcome extends Applet // Extending the code in Applet { public void paint(Graphics g) //g is just an argument { g.drawString("Welcome to Java!", 25, 25); } } • Compile with javac Welcome.java- Produces: Welcome.class • File Welcome.html; <html> <applet code="Welcome.class" width=275 height=100> </applet> </html> • To run the applet use; Appletviewer Welcome.html...
View Full Document

This note was uploaded on 11/04/2010 for the course CPSC 233 taught by Professor Li during the Fall '09 term at University of Calgary.

Page1 / 2

Lecture 2 - The Java Software Development Kit - public...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online