- The JDK should already be installed on the system. However, you
will need to make changes to your login shell (or profile) to
access the compiler/interpreter, and to access the library.
- Let's assume the Java Development Kit is installed in
/usr/local/jdk1.2/
and that the compiler executable is in
/usr/local/jdk1.2/bin/
and that the library is in
/usr/local/jdk1.2/lib/
- The following instructions are given for C-shell (csh or tcsh). If
you are running ksh, you'll need to do a "export".
- First, add the bin directory to your PATH:
setenv PATH $PATH:/usr/local/jdk1.2/bin
- Second, create the CLASSPATH environment variable:
setenv CLASSPATH /usr/local/jdk1.2/lib:.
(Don't forget the colon and the dot at the end).
- Now, log out and log back in. You should be able to access the
compiler and interpreter at the Unix command line:
% javac
% java
If not, don't go any further but fix the path problems now.
- Just to be sure, create a HelloWorld.java file, compile and run it:
public class HelloWorld {
public static void main (String[] argv)
{
System.out.println ("Hello World!");
}
}