Friday, February 22, 2013

Install oracle java 7 in ubuntu 12.04


Firstly, I don't take credit of this.
I was in need to install java on a new Ubuntu instance in Amazon Web Services.
I found these commands after a long searching and was unaware that Ubuntu needs a  special treatment to install Java.
To install Java you can use following commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

You can check the java version by searching java in dashboard.
Or
If you run:

file /etc/alternatives/java /etc/alternatives/javac
You will get output something like :
/etc/alternatives/java:  symbolic link to `/usr/lib/jvm/java-7-oracle/jre/bin/java'
/etc/alternatives/javac: symbolic link to `/usr/lib/jvm/java-7-oracle/bin/javac'
 Which obviously means you have Java version 7 installed.
This assumes the "alternatives" system is working properly, which might not be the case, depending on how Java has been "messed up" in the past. To check this, run:
file `which java javac`
 Which will show the path where Java is installed.

2 comments:

  1. That is really good and useful blog. It is saying that one should gain knowledge. Thank you for sharing it with us

    ReplyDelete
  2. Excellent way of installing Oracle java7 in new Ubuntu instance using a few simple steps and eliminating complications of the procedure.

    ReplyDelete