OSF1 (osf1.gmu.edu) is the main campus computer, located in Thompson Hall. Terminal clusters are located throughout the campus, or it can be accessed through the campus dial-in network (703-4262468). Student accounts may be obtained by going to Thompson Hall.
The following instructions for compiling Java programs on OSF1 are divided into two steps. Step 1 tells you how to set up your environment to use the compiler, and Step 2 tells you how to compile Java programs. You only need to do Step 1 once.
which javac
If the system responds with a name /usr/bin/javac, then path
is correctly set. If the system responds with a message that there is no javac
(and then gives a list of all the places it tried), then you must update path.
set path =. . .
and modify it as follows:
set path =. . .:/usr/bin
This will allow you to access the compiler.
setenv CLASSPATH . . .:.:$(HOME)/myclasses
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