Grab the sdk from java.com. For us, we are going to install this on Lobstora, which is a GNU/Linux box. Just make the binary executable and run it:
[root@srv-1 opt]# chmod 700 j2*.bin [root@srv-1 opt]# ./j2sdk-1_4_2_03-linux-i586.bin |
We like putting this in /opt with a symlink to j2sdk.
[root@srv-1 opt]# ln -s j2sdk1.4.2_03 j2sdk [root@srv-1 opt]# ls -l total 20 lrwxrwxrwx 1 root root 13 Jan 24 11:03 j2sdk -> j2sdk1.4.2_03 drwxr-xr-x 9 root root 4096 Jan 24 09:32 j2sdk1.4.2_03 drwx------ 2 root root 16384 Jan 19 13:29 lost+found [root@srv-1 opt]# |
Let’s set up the environment variables and the path in /etc/profile:
JAVA_HOME="/opt/j2sdk" PATH="$PATH:/opt/j2sdk/bin" export PATH JAVA_HOME USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC [root@srv-1 opt]# source /etc/profile [root@srv-1 opt]# set . . . JAVA_HOME=/opt/j2sdk . . . PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin: /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/j2sdk/bin . . . [root@srv-1 opt]# java -version java version "1.4.2_03" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02) Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode) [root@srv-1 opt]# |
Looking good.