OpenJDK + Glasshfish + centOS

To show OpenJDK current version

To install openJDK please follow:

$ update-alternatives --display java
 slave pack200.1.gz: (null)
 slave rmid.1.gz: (null)
 slave rmiregistry.1.gz: (null)
 slave servertool.1.gz: (null)
 slave tnameserv.1.gz: (null)
 slave unpack200.1.gz: (null)
 Current `best' version is /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java.

Java environment setup

Set JAVA_HOME / PATH for a single user
Login to your account and open .bash_profile file

$ vi ~/.bash_profile

Set JAVA_HOME as follows using syntax export JAVA_HOME=. set it as follows:

export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

Set PATH as follows:

export PATH=$PATH:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin

Type the following command to activate the new path settings immediately:

$ source ~/.bash_profile


$ . ~/.bash_profile

Verify new settings:

$ echo $JAVA_HOME
$ echo $PATH
$ which java

Set JAVA_HOME / PATH for all user

You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:

vi /etc/profile

Next setup PATH / JAVA_PATH variables as follows:

export PATH=$PATH:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin
export PATH=$PATH:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin

Save and close the file. Once again you need to type the following command to activate the path settings immediately:

source /etc/profile
. /etc/profile 

Important link: