CISC 370 Spring 00 Instructions for
Configuring Java on Strauss

Course Home Syllabus Lectures Example Programs Exercise Solns CoreJava Progs
Documentation
Gen'l Docs Java 2 APIs Java Glossary Term Proj Info


Java on Strauss

On Strauss we will be using Java 1.2.2 (J2SE). You can get the Java software for your PC from the SUN download web page. . On Strauss, the Java 1.2.2 files are found in the directory /usr/jdk1.2.2/.

  • New users should check their path settings with the command:
    %java -version
    
    which should produce the response
    java version "1.2.2"
    Classic VM (build JDK-1.2.2-001, green threads, sunwjit)
    

    If you do not get this response, you need to add /usr/jdk1.2.2/bin (before /usr/bin where an older version of Java resides) to your Unix path variable. If you do not know how to do this, see the TA, Sivaram Burra, or a consultant in the basement of Smith Hall.

  • Set the CLASSPATH shell variable. The class path is a sequence of directories (or zip files), separated by colons, that the Java compiler, javac, searches for classes not already defined in any of the files specified directly as command arguments. The compiler looks in the class path for both a source file and a class file, recompiling the source (and regenerating the class file) if it is newer.

    Note that the system always appends the location of the system classes onto the end of the class path unless using the -classpath option to specify a path.

    To set CLASSPATH, put the following lines in the file   ~/.localenv   or   ~/.cshrc.

         # Add for Java
         setenv CISC370HOME /home/base/usrc/35/13772/Class/CISC370-00S
         setenv CLASSPATH .:$CISC370HOME/CoreJavaBook:$CISC370HOME/example-progs
         

    Conventions that must be followed

    Java is very strict on file names. There can be only one public class per file and the source file name must be ClassName.java (case is important). You must make sure the file name is correct.

    The compiler may generate several .class files - one for each class in your source file. The bytecode of a class will be in the file ClassName.class. Anonymous inner classes will have the name ClassName$count.class where ClassName is the name of the parent class and count is an integer.

    When you begin a project it is best to make a new directory and put all your related .java files in this directory with the correct names. To recompile just use the command "javac *.java." When you are done you may want to consider packaging all your class files, data files, etc., into one java archive using the jar command. This is also easier if you have your project organized in one directory.

    Documentation for the Tools javac, java, and jar

    Documentation for using the Java compiler javac .
    Documentation for invoking a Java application class file using the Java application launcher java .
    And documentation for using the Java archive tool jar . Jar is similar to the Unix tool tar.

    The html pages come from the JavaSoft web site.

    Acknowledgment

    Thanks to Dr. Dean Nairn for his help with the above info.

    Back to the CISC 370 homepage.

    This page has been accessed times since 7 Feb 2000.

    Corrections, suggestions and comments to caviness@cis.udel.edu

    Last updated 10 Feb 2000.

    Copyright 2000 B. F. Caviness