Enterprise Java for Linux HOWTO
mkdir /usr/local/sun
mv jdk1_2_2rc1-linux-i386.tar.gz /usr/local/sun
You can now open the distribution package. To do this, type:
tar zxvf jdk1_2_2rc1-linux-i386.tar.gz
Under the /usr/local/sun directory, you now should see the jdk1.2.2 directory.
The above example shows JDK 1.2.2 release candidate 1 for the Intel architecture. Substitute the filenames as
appropriate.
Setting up Your Environment
The environment variables to set up are:
JAVA_HOME
PATH
CLASSPATH
The JAVA_HOME environment variable references the home directory of your JDK installation. Set your
JAVA_HOME environment variable to the directory into which you just installed a version of J2SE.
export JAVA_HOME=/usr/local/sun/jdk1.2.2
The $JAVA_HOME/bin directory has the Java compiler (javac) and the Java Virtual Machine (java) as well
as other necessary programs for development. Add $JAVA_HOME/bin to your PATH.
export PATH=$JAVA_HOME/bin:$PATH
Note that $JAVA_HOME/bin was added to the front of the PATH so that the installed JDK will be used
rather than any JDK that might have come with your Linux distribution.
To confirm that your PATH is correctly set up, check which Java compiler and JVM will be used.
which javac
which java
The output should reference javac and java in your $JAVA_HOME/bin directory.
The CLASSPATH environment variable references all JARs and directories that you will need to compile
and run Java programs.
For JDK 1.2.2, you don t need to initially add any JARs to your CLASSPATH. JARs can be packaged in
either .jar or .zip files.
export CLASSPATH=$CLASSPATH:.
Confirming Your Installation
You are now ready to compile and run a simple application. Create the following program.
Setting up Your Environment
11
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved