How to Install JDK under Linux
The following instruction shows the steps to install JDK1.5 64bit on CentOS 4/5:
- Get the package
Download JDK1.5 linux 64bit binary package (jdk-1_5_0_16-linux-amd64.bin) from Sun website.
- Install
1. Log in as root;
2. Copy the jdk-1_5_0_16-linux-amd64.bin to /usr/local/lib64;
3. Add execute permit on it and run it to extract:
# chmod +x jdk-1_5_0_16-linux-amd64.bin
# ./jdk-1_5_0_16-linux-amd64.bin
The binary code license is displayed. Enter "yes" to continue.
The JDK files are installed in /usr/local/lib64/jdk1.5.0_16
4. Delete the binary package to release disk space:
# rm jdk-1_5_0_16-linux-amd64.bin
- Set envirenment
1. Log in as root;
2. Edit /etc/user.bashrc to add following lines:
# JDK path
if [ -d /usr/local/lib64/jdk1.5.0_16 ]
then
export JAVA_HOME=/usr/local/lib64/jdk1.5.0_16
fi
- Test installation
1. Log in as normal user;
2. Run the following command:
$ java -version
Java version information should be displayed.