Home > Java, JDK7, LINUX, UBUNTU > INSTALL ORACLE JAVA 7 IN UBUNTU 12.10

INSTALL ORACLE JAVA 7 IN UBUNTU 12.10

To install Java in Ubuntu/Linux  open Terminal (Press Ctrl+Alt+T) and copy the following commands in the Terminal:

  • sudo mkdir -p /usr/local/java

For 32-bit users:

  • wget -O jre-32bit.tar.gz http://goo.gl/5UycT
  • wget -O jdk-32bit.tar.gz http://goo.gl/YPKJz
  • sudo -s cp -r jre-32bit.tar.gz /usr/local/java
  • sudo -s cp -r jdk-32bit.tar.gz /usr/local/java
  • cd /usr/local/java
  • sudo -s tar xvzf jre-32bit.tar.gz
  • sudo -s tar xvzf jdk-32bit.tar.gz

For 64-bit users:

  • wget -O jdk-64bit.tar.gz http://goo.gl/MSzBj
  • wget -O jre-64bit.tar.gz http://goo.gl/yZgjI
  • sudo -s cp -r jre-64bit.tar.gz /usr/local/java
  • sudo -s cp -r jdk-64bit.tar.gz /usr/local/java
  • cd /usr/local/java
  • sudo -s chmod a+x jre-64bit.tar.gz
  • sudo -s chmod a+x jdk-64bit.tar.gz
  • sudo -s tar xvzf jre-64bit.tar.gz
  • sudo -s tar xvzf jdk-64bit.tar.gz

Now you need to enter these command (both 32-bit and 64-bit users):

  • sudo nano /etc/profile

Add the following lines at the end of file:

JAVA_HOME=/usr/local/java/jdk*
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JRE_HOME=/usr/local/java/jre*
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

Copy above lines and to paste in terminal (Press Ctrl+Shift+V) and to save file using nano (Press Ctrl+O) then (Press Ctrl+X) to exit from file.

Now enter following commands one by one in terminal:

  • sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jre1.7.0_12/bin/java” 1
  • sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.7.0_12/bin/javac” 1
  • sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jre1.7.0_12/bin/javaws” 1
  • sudo update-alternatives –set java /usr/local/java/jre1.7.0_12/bin/java
  • sudo update-alternatives –set javac /usr/local/java/jdk1.7.0_12/bin/javac
  • sudo update-alternatives –set javaws /usr/local/java/jre1.7.0_12/bin/javaws
  • . /etc/profile

Check installed java version:

  • java -version

 

That’s it, Enjoy!!!

 

 

Categories: Java, JDK7, LINUX, UBUNTU
  1. Sairam
    March 31, 2013 at 10:41 AM

    Great!!! It really helped me. Can you please update about Eclipse and Tocat which I am looking on priority basis.

  2. April 16, 2013 at 10:41 AM

    This is Awesome! Thank you so much.

  3. April 20, 2013 at 1:43 AM

    Thanks a ton for posting this, I discovered it extremely informative, and it answered most from the concerns I had.

  4. April 21, 2013 at 11:13 AM

    Pretty great post. I just stumbled upon your blog and wanted to say that I have very enjoyed reading your blog posts. Any way I will be subscribing for your feed and I hope you post again soon.

  5. December 1, 2013 at 5:36 AM

    I’m excited to find this great site. I want to to thank you for your time just for this fantastic read!!
    I definitely liked every little bit of it and
    i also have you book marked to look at new information on your blog.

  1. April 3, 2013 at 6:25 PM
    Mahesh d shukla

Leave a comment