5

I am trying to install oracle jdk7 64bit on my computer.

I found this How do I install Oracle Java JDK 7?

It uses update-alternative -install to install the JDK which is new to me.

I used to only extract the files and add the jdk location to the PATH environment variable before.

Now it seems that I have to run the following commands more than once if I want to install other executables:

sudo update-alternatives --install "/usr/bin/xx" "xx" "/usr/lib/jvm/jdk1.7.0/bin/xx" 1
sudo chmod a+x /usr/bin/xx

Just like the post said:

N.B. remember - Java JDK has many more executables that you can similarly install as above. java, javac, javaws are probably the most frequently required.

I think this is rather inflexible. So I want to know what the advantage of using update-alternative to install jdk over other methods is.

5 Answers 5

7

The command sudo apt-get install openjdk-7-jdk should do the job. If there is a dependency problem run

 sudo apt-get -f install

and rerun the earlier command.

2
  • The original post asked for Oracle JDK.
    – H2ONaCl
    Dec 31, 2015 at 3:41
  • My answer has been accepted by the OP. I don't know what I can do now after more than two years ;)
    – Jay
    Dec 31, 2015 at 5:09
5

There's an easier way to do it: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
1
  • This is super handy. I just signed up to up-vote this. Thanks.
    – Sam R.
    Oct 21, 2013 at 22:23
0

The command is for telling the system what the global java commands should execute. If you can live with just downloading a tar.gz file from Oracle and setting your PATH variable then just do that.

I usually just install the openjdk-7-jdk package to get what I need and do not worry any more about that.

2
  • I will do the android development. And it does not support the openjdk.
    – hguser
    Apr 11, 2013 at 5:10
  • This it important information that you might consider adding to your question. Apr 11, 2013 at 7:03
0

I'm noob. Hope somebody can correct me if i'm wrong.

You can install Oracle Java JDK apart from what already install in ubuntu which is OpenJDK. But you must aware that it's not safe and stable and oracle will always make update to its repository. You must update them manually to use the latest Oracle Java JDK, and also you must configure your browser to use Oracle Java JDK instead of OpenJDK which is more stable, safe, easy to install and update. If nothing important just stick with OpenJDK.

Hope it help. Thankyou.

0

The default jdk in Ubuntu 12.04 and later releases is default-jdk To install it type:

sudo apt-get install default-jdk  

Although the jdk version is updated in newer releases, the above command will always install the default jdk version in any Ubuntu release.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .