I would like to update my java version (UPDATE, not install) on my ubuntu 12.04 computer. I currently have java 7.x, and I would like to update it to the newest version possible (8.0 at least) without it being too complicated.
Java 8 is not available in the Ubuntu 12.04 repositories, but it is available from a Launchpad PPA.
You also cannot update a Java version to the next Java version, but you can install different Java versions side by side.
To install Java version 8 (OpenJDK 8 edition - not ORACLE Java 8) open a terminal and execute :
If you only want to install the Java Runtime Environment :
Note 1 :
As you said "... without it being too complicated ...", I assumed that you installed Java 7 from the Ubuntu repositories, which contain OpenJDK and did not add the WebUpd8 PPA (ORACLE Java).
Note 2 :
As you said that you get the
Keep both versions installed side by side, some other packages or programs might rely on Java 7.
However, when you don't want to have both versions and if don't need Java 7 anymore ... remove it.
As you did not specify whether you want to install OpenJDK or Oracle JDK, my answer covers Oracle JDK.
It is interesting to quote this text from here. What follows applies to JDK8 too and for all Ubuntu versions of yours or higher.
Note that JDK9 is expected to be released during this year, so do not try to use before that.
For this reason, this is is how to install (and not update) your Java 8 version:
Adding to the earlier answers...I had issues with my JAVA_HOME after the install from this ppa following this commands:
The 4th command doesn't work as expected. So in my case I have to manually run these commands:
and then it was working fine. verify it also:
I referred this link. Hope this helps
An alternative is the Zulu port of OpenJDK which can be downloaded as a zip file, unpacked and used directly.
If needing to run from the command line, consider prepending the bin directory to $PATH in .bash_profile.
Downloads available at http://www.azul.com/downloads/zulu/zulu-linux/
(untested as I do not have a 12.04 system available. It appears though that the requirement of glibc being at least 2.5 is satisfied)
If you want keep both versions, and switch depending on your needs, consider the command:
to make sure that a particular java (sun-java) is the default runtime.