How can I install jdk 64-bit on ubuntu 12.04 or 14.04 LTS?
I have downloaded jdk-8u20-linux-x64.tar.gz from oracle website, as I am new to ubuntu, I need an easy way to install jdk, any body Help if possible.
please write the installation step by step, and please do not leave any link to other website, thank your for your help.
The accepted answer is good, but looks like it is possibly a bit outdated and does not work on debian installations. In order to get java installed in a debian-based linux distribution create the ppa and import the keys by yourself. (this is the same ppa from webupd8team, but added manually)
First, you need to add webupd8team Java PPA repository in your system. Edit a new PPA file /etc/apt/sources.list.d/java-8-debian.list
using your favorite text editor. For instance...
$ sudo vim /etc/apt/sources.list.d/java-8-debian.list
... and add following content in it:
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
Now import GPG key on your system for validating packages before installing them.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
As in the accepted answer (replace X with the target version):
$ sudo apt-get update
$ sudo apt-get install oracle-javaX-installer
After the installation script concludes verify the installation with:
$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
If you want the easy route to installing and updating Oracle Java 8(including the JRE, JDK and plugins for browsers) on Ubuntu 12.04 (or later) then I recommend doing it this way. First delete the file you downloaded as it isn't needed and proceed with these instructions:
Open a Linux terminal (command prompt) and issue these commands:
sudo add-apt-repository ppa:webupd8team/java
This will add a repository where developers place updated version of Oracle Java 8 in a format easily installed by Ubuntu package managers. When running that command it may (or may not prompt) you for your password. If it asks for a password enter your user account password. After it runs it will display information and then prompt you to hit Enter. Hit enter
key to continue. You should be back at a shell prompt. Now issue these 2 commands:
sudo apt-get update
You will be prompted "Do you want to continue?". Hit y
and enter
When completed it will return to the shell prompt. Now issue this command:
sudo apt-get install oracle-java8-installer
This will download Oracle Java 8 and install it. Information will scroll past on the screen but when finished java should be installed. I did verify on my system that this repository is up to date and using the version of Oracle Java 8 referenced in your question.
To verify that Oracle Java 8 can be found and is the right version issue this command:
java -version
It should respond with information pretty similar to this:
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
If yours shows the SE Runtime as build 1.8.0_20-b26 then you are good to go.
If in the future you do a package upgrade (through the GUI or command line) it will look for a new version of Oracle Java along with all the other installed packages on your system.
From the command line you can always attempt to do an upgrade on all packages (including Oracle Java) with this command:
sudo apt-get upgrade
If you ever wish to remove Oracle Java 8 you can use this command:
sudo apt-get remove oracle-java8-installer
I'm using something like the following to download and install the latest Java 8 (OpenJDK). Should work on RedHat and Oracle Linux as well as Ubuntu:
JDK_ALT_LINK_JAVA=/usr/bin/java
URL_TO_DOWNLOAD='http://www.java.net/download/jdk8u60/archive/b17/binaries/jdk-8u60-ea-bin-b17-linux-x64-26_may_2015.tar.gz'
JDK8_ARCHIVE=$(basename $URL_TO_DOWNLOAD)
wget "${URL_TO_DOWNLOAD}"
tar zxf "${JDK8_ARCHIVE}"
mv jdk1.8.0_60/ /usr/lib/jvm/
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_60/bin/java 1008000060
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With