Thursday, 18 April 2013

Java Installation step by step in Linux and Ubuntu

Java 1.7 Installation                         


Download Java Package HERE

  • Create a Directory
root@rahul-desktop~]#mkdir -p /usr/java
  • Extract JDK.tar file to the Directory
root@rahul-desktop~]#tar -xvf jdk-7u11-linux-i586.tar.gz -C /var/java
  • Now delete the old java and update new

root@rahul-desktop~]#cd /etc/alternatives/

root@rahul-desktop alternatives]# rm -f java javac keytool
root@rahul-desktop alternatives]# ln -s /usr/java/jdk1.7.0_11/bin/java .
root@rahul-desktopalternatives]# ln -s /usr/java/jdk1.7.0_11/bin/javac .
root@lrahul-desktop alternatives]# ln -s /usr/java/jdk1.7.0_11/bin/keytool .

  • Set the class path
root@rahul-desktop~]# vi .bash_profile or .bashrc
export PATH=$PATH:/usr/java/jdk1.7.0_11/bin/
export CLASS=$CLASSPATH:/usr/java/jdk1.7.0_11/jre/lib
:wq!

  • Now Verify 
root@rahul-desktop~]#source .bashrc
root@rahul-desktop~]#echo $JAVA_HOME
/usr/java/jdk1.7.0_11
root@rahul-desktop~]#java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Client VM (build 23.6-b04, mixed mode)

No comments:

Post a Comment