rating rating rating rating rating rated by 1 please register or login to rate

Java installation on CentOS 5.5

Attention: open in a new window. PDFPrintE-mail

The installation of JAVA on a CentOS 5.5 Server is not as hard as it used to be and takes only about 5 minutes of time.

 

What i would suggest is downloading the latest rpm version from sun (sorry, I meant oracle... ) and upload it to the server via sftp. The java download link is right here...

once you have uploaded your file to the server all that we have to do is change the permissions of the file to allow execution and finally run the program to install. That is done by typing the following:

sudo -i
chmod +x /path-to-file/jdk-6u22-linux-*-rpm.bin
cd /path-to-binary/
./jdk-6u22-linux-*-rpm.bin
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_22/jre/bin/java 20000
This is for a jdk download for a 64bit OS. Should you have a 32bit OS the last line would be:
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_22/jre/bin/javaws 20000
Note that you have to substitute the version for your installation base, and in addition you would need to change jdk to jre if you intend to install the run-time only. To check the version run
java -version
This should result in a prompt showing the recently installed java version. The last thing to do is to export the JAVA_HOME variable
export JAVA_HOME="/usr/java/jdk1.6.0_22"

Congratulations, java should be up and running...

System Administration