INFS 590: PC Java Instructions

INFS 590 Handouts
Wei Ding, modified by Jeff Offutt

First, you should download the JDK , and follow the instructions step by step. After the installation of JDK on your PC is complete, check your AUTOEXEC.BAT file. There should be two modifications:

The PATH should contain the Java compiler directory (such as \jdk1.1.2\bin ). For example,

SET PATH= . . .;C:\jdk1.1.2\bin; . . .

There must also be an environment variable called CLASSPATH that looks like this for the default installation:

SET CLASSPATH=C:\Jdk1.1.2\lib\; . . .

The exact order of the directories in the path and class path does not matter, nor does the case. However, if you installed the JDK to a different location than the default, then you must manually update the PATH and CLASSPATH.

Java source files should use the extensions "java" for bodies. For example, your first program could be called "1st_prog.java". Compile an Java program with the following commands:

javac 1st_prog.java  -- javac is the Java compiler. It compiles the file 
                        1st_prog.java into the file 1st_prog.class.
java 1st_prog        -- java is Java the interpreter. It interprets the
                        bytecodes that the compiler placed in the class file.
Wei Ding
Jan, 1999