Thursday, October 7, 2010

Installing Java Runtime Environment in Linux


You can download SUN's latest Java JDKs at:
# mkdir -p /usr/java
# cd /usr/java
# cp downlod directory/jdk-6u21-linux-i586.bin /usr/java
# chmod 700 jdk-6u21-linux-i586.bin
# ./jdk-6u21-linux-i586.bin
...
   creating: jdk1.6.0_21/
   creating: jdk1.6.0_21/db/
   creating: jdk1.6.0_21/db/bin/
  inflating: jdk1.6.0_21/db/bin/ij   
  inflating: jdk1.6.0_21/db/bin/NetworkServerControl  
  inflating: jdk1.6.0_21/db/bin/setNetworkClientCP.bat  
  inflating: jdk1.6.0_21/db/bin/derby_common.sh  
...
Done.
# export JAVA_HOME=/usr/java/jdk1.6.0_21
# export PATH=$JAVA_HOME/bin:$PATH
# which java
/usr/java/jjdk1.6.0_21/bin/java
# java -version
java version "1.6.0_21"

Java(TM) SE Runtime Environment (build 1.6.0_21-b06)

Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)
For permanent system setting environment variable for all user

# vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.7.0
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib:$CLASSPATH
export CATALINA_HOME=/opt/apache-tomcat-7.0.21
export CATALINA_BASE=/opt/apache-tomcat-7.0.21

put above line in profile file
for particular user just put above line in user .bash_profile  file

Note: For  jdk-6u21-linux-i586.tar.gz just extract all file in /usr/java/

 

2 comments: