Java is the widely used programming language used by billion of application. Generally, every system required Java installed there. You may also need to Install Oracle Java 8 on your Linux system. You will require the PPA maintained by Webupd8 Team to Install Java 8 on Your Ubuntu and LinuxMint system.
- Read this => Install Java 8 on Debian
- Read this => Install Java 8 on CentOS, RHEL & Fedora
Use this tutorial to install Oracle Java 8 (JDK 8u151) on Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04 LTS and LinuxMint 18, 17 systems using PPA.
Step 1 – Install JAVA 8
First of all, you need to add webupd8team Java PPA repository in your system. After that install, Oracle Java 8 using following a set of commands.
sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get install oracle-java8-installer
Step 2 – Verify Installed Java Version
After successfully installing Oracle Java using above step verify installed version using the following command.
java -version java version "1.8.0_151 " Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
Step 3 – Setup Java Environment
Also, install Java configuration package. It seems like below package is already installed with latest operating systems during installation of JAVA packages. But you can still make sure by running below command.
sudo apt-get install oracle-java8-set-default
Now add the JAVA_HOME and JRE_HOME environment variable in /etc/environment configuration file using following command.
cat >> /etc/environment <<EOL JAVA_HOME=/usr/lib/jvm/java-8-oracle JRE_HOME=/usr/lib/jvm/java-8-oracle/jre EOL
Finally, You have successfully installed Java 8 on your system. In addition if you are looking for Google chrome installation visit Install Google Chrome on Ubuntu & LinuxMint
step 1 Can do add-apt-repository ppa:webupd8team/java && apt-get update && apt-get install oracle-java8-installer allso little bit easy π
hi,
there is an error with python-samba while installing oracle-java8-installer.
[/var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.9_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)]
how can i solve this problem?
i’m not being able to edit the etc/environment file!!!
please help?!
Hello:
You you either open ‘Files’ or ‘nautilus’ with root privileges, you will be able to open the etc/environment file, edit it and save afterward.
the easiest way is to do it through the terminal using sudo for root access (which enables you to edit sensitive files)
$ sudo gedit /etc/environment
add the lines
then save.
done.
This seems to install JRE _not_ JDK as the title of the article states.
Several people have pointed this out in the comments yet these queries remain unanswered.
Perhaps the title of the article is incorrect…
Hi Tim,
This installs JDK and JRE both. After installation you can check install java compiler.
$ javac -version
javac 1.8.0_111
Thank you! This works Great! I was also able to integrate Apache Solr on my website
I am thinking about keeping this up and going on my vps server
Hello, i f i understand this will install JDK too. But i cant find my JDK directory.
any help or explanation ? thank you in advance
I didn’t get a JDK downloaded either. Does anyone have a suggestion ?
I don’t like it.. It’s too easy.
Do you have a harder example?
This is simple and extremely easy explanation
I want know becouse we make donwload of archive on site of oracle and that file i dont can install
1-up!!! Thanks! you saved my day π
Thanks for your suggestions, this solution is fast and understandable. i owe you one π
that is the best guide of the INTERNET, thanks man.
Thank you maaaan!
I’ve installed java 1.8 on two devices thanks to this beautiful simple process
π you da man thanks!
Great guide.
Thanks!
If you get “Cannot add PPA ‘ppa:cooperjona/lightread’ . Please check that the PPA name or format is correct.” error
sudo -E add-apt-repository ppa:ppaname/ppa
instead of
sudo add-apt-repository ppa:ppaname/ppa
thanks
Genio, muchas gracias. Saludos desde Argentina!
This saved my day! Thank you!
This saved me a whole day of manually doing it myself. Thanks so much!!
Great step-by-step process document!! Thanks.
thanks!
Thanks a lot! You all helped me a lot!
nice documentation
i already had java7. after installing java8, java- -version still gives jdk7… whats the solution?
Thanks for the great instructions!
Thank you !
Thank you very much !!
Thank You so much
Thank bro none of the site help out on google but u r site instruction was extremely perfect….
This article was extremely helpful. Please keep posting Linux and Java related articles.
Thanks for a simple and great HOWTO! π
hi guys i am getting this error)
(http://download.oracle.com/otn-pub/java/jdk/8u72-b15/jdk-8u72-linux-i586.tar.gz
Connecting to download.oracle.com (download.oracle.com)|180.149.61.152|:80… connected.
HTTP request sent, awaiting response… Read error (Connection reset by peer) in headers.
Retrying.)
upto try:5 after that download fail NOT inst error please help
Encountered the same issue – i had to modify the timeout settings in /var/lib/dpkg/info/oracle-java8-installer.postinst to make it run. Sadly, the installer script doesn’t use the system-wide /etc/wgetrc but creates its own wgetrc each time it runs. So, you’ll have to search for the line “echo “timeout = 15″ >> wgetrc” in the postinst file i’ve mentioned above. Now, just set a longer timeout or remove the line completely.
Thank you very much
It is not working for me.
Hi,
What issue are you facing ?
Thanks man. It works perfectly.
Muy ΓΊtil, muchas gracias.
Very useful tutorial…
Thank you
hey!!! so usefull!!!! thank a lot!!!!! π
Thanks dude searched everywhere for guides but yours is the best and easiest.
Thank you π
Hey, i’am new with linux and its very usefull thanks for the tutorial.
Thank you very much for this. It helped a lot!
I’m getting an error when running the command:
sudo add-apt-repository ppa:webupd8team/java
The error is:
Cannot add PPA: ‘ppa:~webupd8team/ubuntu/java’.
ERROR: ‘~webupd8team’ user or team does not exist.
Hi Ian,
Its still working for me. Please confirm what OS version are you using ?
Thanks but it’s not working for me, this is the message i got:
~ $ sudo apt-get update
E: Type ‘sudo’ is not known on line 1 in source list /etc/apt/sources.list.d/mono-xamarin.list
E: The list of sources could not be read.
Very nice, simple and useful
Sure wish this wasn’t the first item coming up in a google search of “installing java 8 jdk on ubuntu” because this isn’t the jdk!
I agree with you comment !!! It’s not a JDK and only a Runtime then, no option to compile (no javac compiler)
Thanks a lot!
Nice article. So the reference in my blog yes
Thanks a lot
thanks
Thanks for that short advice, for now everything is working π and let it stay in this way π
Thank you!
thank, ..thank you very much, very nice work
Very Nice, thanks!
you follow this post and enjoy java8. very nice work done by techadmin.
Thanks dude Β° this information was util.
Good job!
Does not work trows class not found exception
everything went in a breeze – cool
thanks
looking for manual procedure to do stepbystep as well
Thanks a lot.
Very helpful.
Thanks man!! Worked like a champ!
Muito obrigado amigo.
Thank you very useful
Thanks
While installing throw sha256sum mismatch jdk-8u60-linux-x64.tar.gz
please help me to out this problem
Thank you so much……Really really helped alot….. π
Is there a way to get it to move up from 51 to 60? The website says I am behind!
Thanks very thamkful!!
Really helpful information.
Good One!
Webupd8 Java PPA DOWN!!!!! When will it be updated?
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ppa.launchpad.net trusty Release: The following signatures were invalid: BADSIG C2518248EEA14886 Launchpad VLC
W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/Release
W: Some index files failed to download. They have been ignored, or old ones used instead.
thankyou somuch
Thank you sharing a such helpful article
idk how to install this
Hi Rahul,
I am new to Ubuntu. I tried the setps to install jdk 1.8.
While setting environment, I found the error
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/rt.pack
jsse.jar…
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/jsse.pack
charsets.jar…
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/charsets.pack
localedata.jar…
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/ext/localedata.pack
jfxrt.jar…
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/ext/jfxrt.pack
plugin.jar…
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/plugin.pack
javaws.jar…
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/javaws.pack
deploy.jar…
Error: Could not open input file: /usr/java/jre1.8.0_45/lib/deploy.pack
/var/lib/dpkg/info/jre1.8.0-45.postinst: line 641: /usr/sbin/alternatives: No such file or directory
dpkg: error processing package jre1.8.0-45 (–configure):
subprocess installed post-installation script returned error exit status 127
Setting up oracle-java8-set-default (8u45+8u33arm-1~webupd8~1) …
Errors were encountered while processing:
jre1.8.0-45
E: Sub-process /usr/bin/dpkg returned an error code (1)
What should I do to set environment ?
Same here, HARSHITA.
Worse: I can’t install any package since I’ve tried to install this using this tutorial. Can someone help please?
Zoli
EDIT: Maybe a helpful hint, I did a…
java -version
…this shows me…
java version “1.9.0-ea”
Java(TM) SE Runtime Environment (build 1.9.0-ea-b70)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b70, mixed mode)
So the error messages seem to come from an older installation, that I have to remove. But how?
Zoli
Very helpful article.
Very helpful,
Thanks !!!
Very helpful article. Thanks.
Hi,
I would like to thank you for helping the non techs like myself first. Could you help me with a problem I get? I am using LM 17.1 and trying to do the installation I get the Binary Code License Agreement display at mt terminal window. There is no way to click ok or accept those terms, failing which the installation aborts. Can you tell me a way around, or what am I doing wrong?
Thanks
Amit
use arrow keys to move, enter to accept
Thank you!! It works!.
Thanks for the info! very helpful…
Thank you so much, this helped a lot !!!!
Thanks from a spanish user!
Thanks! It helped a lot!
if i search, do i have java?, and enter site is says this plugin is not accepted,what i have to do?
Hi Habdul,
Do you mean java is working with browser ? If yes which browser are you using ?
Thank you for kind article to install java 1.8 in Ubuntu 14.04.
It works well. π
Will it work for Ubuntu 14.10?
This is very handy, thank you. And thank you to the Webupd8 Team!
thank you, greetings from MΓ©xico.
You made my day,, thanks allot
Hi,
I could install java 8 as you wrote, but I still can not set java 8 as a default JRE. And when I would like to add it to the installed JREs I cant find it. Where should it be?
Thank you!
thanks for post !! it was very helpful for me !
Thanks for the guide.. worked fine for me
Thank you very much. This is really helpful.
Awesome! very helpful!
Very useful. Thank you.
Very Easy for install Java in Ubuntu π
Nice Job
great! i always wonder why we haven’t something like a repo to install jdk!
great work
Thanks a lot. Quick, easy and it installs both JDK and JRE version 8!
Wonderful and helpful.
A written tutorial on how to install using the already downloaded tar.gz file will be helpful too. Thanks
This installs the JRE not the JDK/SDK. Is not the same ….
Nice tutorial!
But now, How do you uninstall it?
Packages can be removed with
>sudo apt-get –purge remove packageName
apt-get remove may some times leave behind some files.
–purge will remove all files.
Hi, whish all of costum installs have these very good install help,
saves lots of time , thx,
Hi,
I am getting an error stating the following. Please help.
Cannot add PPA: ‘ppa:webupd8team/java’.
Please check that the PPA name or format is correct.
no problem here with sudo, name (and all further instructions are correct)
Yeah.. same problem here
Thanks man, saved me some time π
thanks! π
Thank you very much, this helped a lot
Very good, help so much
Thank’s for this article!
Thanks! Very helpful.
you guys rock
Thank you so much!
Thank you!
thank you very very much
Missing the – in java -version
Woops! Retract that!
many thanks, this helped a lot!
Thanks!
I canΒ΄t access my bank with open-jdk, only with oracle-java
Useful Information, Thanks
Nice tutorial
Greetings from Mexico Wey!! :3
Thanks!!!! God Thanks!!!!
Hi, these information is very useful. Thank you very much.