Wednesday, November 23, 2011

Some Basic Installation Things about Java

1. Set JAVA alternative:

sudo update-alternatives --config java

2. Set the environment variables for Java:

2.1 type the command:  sudo vim /etc/profile

2.2 Then at the end of the "profile" document, type the following:

#set java environment
export JAVA_HOME=/usr/lib/jvm/java-7-sun

export JRE_HOME=/usr/lib/jvm/java-7-sun/jre

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

2.3 Save the file. And type the following command to apply it immediately:
                        source /etc/profile