Download the latest versions of the Java 2 Development Kit (JDK) or Run-time Engine (JRE), and the accompanying documentation from:
http://java.sun.com |
Installation instructions and release notes for the JDK and JRE are available at the download page.
Make the binary distribution of the JDK executable and extract in a new directory:
chmod +x jdk-xxx.bin cd /usr/local/ .../jdk-xxx.bin |
Install the JDK documentation by unzipping it in the JDK directory:
cd /usr/local/jdk-xxx/ unzip .../jdk-xxx-doc.zip |
Change the ownership of the JDK directory and make it available as /usr/local/j2sdk/:
chown -R root:root /usr/local/jdk-xxx/ ln -s /usr/local/jdk-xxx /usr/local/j2sdk |
If you need only the JRE, the installation would be like this:
chmod +x jre-xxx.bin cd /usr/local/ .../jre-xxx.bin chown -R root:root /usr/local/jre-xxx/ ln -s /usr/local/jre-xxx /usr/local/j2re |
Using JDK version 1.5.0 caused our Tomcat server to crash every now and then:
|
For the (previously used) BlackDown Java for Linux distribution: Find yourself a mirror for the BlackDown Java Development Kit at:
There you can download the latest versions of the J2 Software Development Kit (SDK) and Run-time Engine (RE). Make sure you pick out the right version for the gcc library installed on your system. You can find out the version currently installed by typing:
Installation instructions for the Java Development Kit are available as INSTALL-j2sdk and INSTALL-j2re. Make the binary distribution of the SDK executable and extract in a new directory:
Change the ownership of the J2SDK directory and make it available as /usr/local/j2sdk/:
Do the same for the RE:
|
Since we didn't install the JDK and JRE in our path, we have to add the bin/ directories to our $PATH environment variable. To make sure the Java distributions and classes can be found, we set the $JAVA_HOME and $CLASSPATH variables as well.
For the Bourne shells, create a file /etc/profile.d/java.sh:
if ! echo ${PATH} | grep -q /usr/local/j2sdk/bin ; then export PATH=/usr/local/j2sdk/bin:${PATH} fi if ! echo ${PATH} | grep -q /usr/local/j2re/bin ; then export PATH=/usr/local/j2re/bin:${PATH} fi export JAVA_HOME=/usr/local/j2sdk export CLASSPATH=.:/usr/local/j2sdk/lib/tools.jar:/usr/local/j2re/lib/rt.jar |
Set its ownership and access rights:
chown root:root /etc/profile.d/java.sh chmod 755 /etc/profile.d/java.sh |
Do the same for C shells, by creating the file /etc/profile.d/java.csh:
if ( "${path}" !~ */usr/local/j2sdk/bin* ) then set path = ( /usr/local/j2sdk/bin $path ) endif if ( "${path}" !~ */usr/local/j2re/bin* ) then set path = ( /usr/local/j2re/bin $path ) endif setenv JAVA_HOME /usr/local/j2sdk setenv CLASSPATH .:/usr/local/j2sdk/lib/tools.jar:/usr/local/j2re/lib/rt.jar |
and setting its ownership and access rights:
chown root:root /etc/profile.d/java.csh chmod 755 /etc/profile.d/java.csh |
Now the JDK should be available to everyone on your system.
You can test the Java engine by typing:
or create a file Test.java:
and test the compiler:
|