Since 11.10 Ubuntu does not provide the
sun-java-jdk, how do I install it?
migrated from stackoverflow.com Nov 4 '11 at 16:01
This question came from our site for professional and enthusiast programmers.
NOTE: Some of the contents of this answer might have become obsolete and there are some comments where people have reported problems. You're advised to read through the comments first.
Ubuntu 11.10 Oneric
Ubuntu 12.04 Precise
Clean up the historical open jdk:
Add a new repo and install the sdk:
If you want the JRE and the browser plugin:
Ubuntu 12.04 (Precise Pangolin) - another way
Thanks to the comments, please note that you can try this method too: http://www.liberiangeek.net/2012/04/install-oracle-java-jdk-7-in-ubuntu-12-04-precise-pangolin/
Make the sun java the default
You may want to also add the following
You should get the following
Selection Path Priority Status
0 /usr/lib/jvm/java-7-oracle/bin/java 1 auto mode 1 /usr/lib/jvm/java-7-oracle/bin/java 1 manual mode * 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1 manual mode
Press enter to keep the current choice[*], or type selection number: 2
Select (2) and press enter
java version "1.7.0_04" Java(TM) SE Runtime Environment (build 1.7.0_04-b20) Java HotSpot(TM) Server VM (build 23.0-b21, mixed mode)
Make sure git is installed:
Sun/Oracle Java 1.6.0
Build local debs:
Script will build packages from source and place them in local repo, then they can be installed e.g.:
You can see all available packages in
Remember to select the right version:
To setup everything else (like browser plugin, keytool, etc.) you can use this (it will be a long list!):
The script is a wrapper for this Debian script, if you're curious ;)
Oracle Java 1.7.0_51
Here is the patched vesion:
Read more on AskUbuntu
You can install the official package from Oracle :
choose linux as your platform
I'd suggest to go with openjdk if possible (for any average user that is). The only thing you might need from sun/oracle is browser plugin, but that could be installed without installing the jre (just unpack).
protected by Community♦ Mar 6 '12 at 23:15
Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?