Compiling Java Programs on Ocelot

In order to compile classes on ocelot, follow these steps.

  1. Modify the CLASSPATH for Java.
  2. Be sure that the classes directory of your web application is in the CLASSPATH.
  3. Use javac to compile.
  4. If any changes have been made to .cshrc, then execut the command
    source ~/.cshrc

Add classes to the CLASSPATH

Open the .cshrc file on ocelot and look at the CLASSPATH statements. There will be several of them. Check to see if there is a CLASSPATH statement for the classes directory of your web application. It should look something like

setenv CLASSPATH {$CLASSPATH}:{$HOME}/cgs4825/webapps/name-of-web-app/WEB-INF/classes

Add this after the last CLASSPATH statement if there is not one already.

Use javac to Compile

The command to compile files on ocelot is javac. Change to the directory that has the .java file and issue the command

javac someFile.java

This will create the .class file in the same directory. Change the permission of the .class file to 604.