Ray's Tutorial Pages


Developing Java Programs

Compiled by Ray Ortigas

Topics


Using the Java Development Kit (JDK)

The Java Development Kit (JDK) is a bare-bones kit that lets you compile and run Java programs. Use your favourite text editor to edit your Java source files and then follow these directions to compile and run your Java programs.

Note: These directions do not take the use of packages into account. If you find yourself needing to know this, e-mail me at rayo@cs.toronto.edu.

Compiling a Java program

The Java compiler, javac, compiles Java source code (in .java files) into Java byte-codes (in .class files). The arguments to javac are the .java files you wish to compile.

For example, if Foo.java contains a class Foo, then

javac Foo.java

will compile the Foo class as well as any other classes Foo uses.

Running a Java program

To invoke a Java program, you run the Java interpreter, java, and specify the name of the class that contains the main() method. This method must have the following signature (prototype):

public static void main(String[] args)

For example, if Foo.class is the byte-code for a class Foo which contains a main() method, then

java Foo

will begin the program in the main() method in Foo.


Using Java WorkShop (JWS)

Java WorkShop (JWS) is an integrated development environment (IDE). All this means is that it integrates your development tools (e.g. editor, compiler, debugger, project manager, etc.) into one environment. This integration can be quite convenient.

JWS can be found on both the CDF and CDF-PC workstations.

Starting JWS

On a CDF workstation, you can start Java WorkShop (JWS) by typing

jws

at your shell prompt.

On a CDF-PC workstation, you can start Java WorkShop by double-clicking its icon in the Applications group of your Windows NT Start Menu.


Ray's CSC148H Home Page | Ray's CSC324H Home Page

This page is maintained by Ray Ortigas, a teaching assistant at the Department of Computer Science, University of Toronto. If you have any questions or comments about this page, please send e-mail to Ray at rayo@cs.toronto.edu.

Last updated March 21, 1999 09:43.