Using Java

You may use whatever version of Java you wish for compiling your Java howework. However, the code you turn in must compile with Sun's JDK. We recommend that you use the current Sun implementation (JDK 1.2.1, aka Java 2). You can also get this free for a personal machine -- go to the java.sun.com web page and from there to the JDK 1.2 link. (You have to register, but there is no charge.)

Using Java on NT

Java's JDK 1.2  is available in some NT labs (including MSCC).  The executables should be in C:\apps\jdk1.2\bin. On most machines the paths are already set up. Put your java source code in some directory. Get an MSDOS prompt and connect to that directory.

A sample program is HelloWorld.java or type:

public class HelloWorld
{
   public static void main(java.lang.String[] args)
   {
      java.lang.System.out.println("Hello World");
   }
}

To compile this program:

javac HelloWorld.java 

This should create a HelloWorld.class file containing the compiled Java bytecodes. You can now run these through the bytecode interpreter:

java HelloWorld
Hello World

Setup Problems

First make sure Java JDK 1.2 is on your machine. Next check that C:\apps\jdk1.2\bin is on your search path, and that the classpath environment variable is set to . (i.e., period - meaning current directory).

Adding C:\apps\jdk1.2\bin to your PATH

To do this you should go to the Control Pannel and then click on the System icon. Select Environment from the list at the top. Then you are given a window viewing your environment variables. The variable PATH (case not important) should be there. You can click on it and then add C:\apps\jdk1.2\bin. Note that NT seperates seperate items in the path with the ; character not the : character. Now you should hit the Set button and then the Apply button. You might have to logout and log back in again for the path change to really happen.

If you ave trouble getting this to work. You can go to a MSDOS prompt and type:

path C:\apps\jdk1.2\bin;%path%