Running JAVA on the UNIX system in KCCF Rm 221

 

  1. JAVA v1.3 path

 

New user accounts need to be set to refer to the correct path for JAVA 1.3. New users can copy a modified login file using the following command. Type this command from a terminal window in your home directory once you log on to unix: WARNING: this cp command will overwrite your existing .cshrc login file … do this ONLY if you have made no changes to your login file!!

 

                cp  ~larry/cshrc.java  .cshrc

 

For old existing accounts or to check your path type:

 

echo $PATH

 

from the UNIX command prompt. The directory

 

                /usr/java1.3/bin

 

should be in the path and should be the only or first java bin directory listed. If this is not true edit your login profile    .chsrc   and modify the set path statement. This assumes you are using the default tcsh UNIX command shell. Contact the Rm 221 lab assistant if you have problems.

 

Notes:  

(1)  see the SUN step-by-step UNIX getting-started tutorial:

 

                http://java.sun.com/docs/books/tutorial/getStarted/cupojava/unix.html

 

(2) Changes to your login file take effect the next time you log in.

 

  1. UNIX information

 

Unix tutorials and other information links can be found at (note that the capital letters are significant):

 

                http://www.apl.jhu.edu/Misc/Unix-info

 

  1. Create (edit) your JAVA source file(s)

 

a) It is strongly recommended that you use the KCCF UNIX CDE (Common Desktop Environment) screen editor for java source editing

 

b) Alternate editors to use from the UNIX command line

 

 vi, emacs, edit…

 

  1. Compile your JAVA source file

 

After saving your source file, e.g., FirstProgram.java, compile JAVA with the command:

 

javac  FirstProgram.java      note that program name here is case sensitive

 

  1. Run (execute) your program

 

java  FirstProgram                note there is no .java extension here