10

Is there a way to install Oracle Java 8 on Ubuntu 19.04?

The webupd8team/java ppa is empty at the time writing.

kerner1000
  • 4,230

2 Answers2

13

I just upgraded to Ubuntu 19.04 on Sunday and had this exact same problem the webupd8team PPA was removed due to the recent Oracle license changes.

I solved the problem using this script from GitHub: install-java.sh

It is a Bash script that did a professional install of Oracle JDK 1.8_201 using the files I downloaded from Oracle's website. I have just used it today and selected yes to everything. It works like a charm on Ubuntu 19.04. I ran with with the following files that I downloaded from Oracle:

-rwxrwxrwx 1 don don      8409 Sep 26  2018 jce_policy-8.zip
-rwxrwxrwx 1 don don  58807261 Jan 21 22:56 jdk-8u201-linux-x64-demos.tar.gz
-rwxrwxrwx 1 don don 191817140 Jan 21 22:50 jdk-8u201-linux-x64.tar.gz

It installs JDK into /usr/lib/jvm and adds the programs (java, javac, etc.) to /usr/bin, and will update or add JAVA_HOME to your bashrc file.

I tested the installation by running a GUI Java program from my desktop. Everything is working perfectly.

Don
  • 231
  • I would like to add that some files and folders ended up with another owner and or group id so I fixed that with $ sudo chown -R root:root /usr/lib/jvm/jdk1.8.0_201/ – Don Apr 24 '19 at 23:16
  • exactly what I needed, works like a charm, thanks! – RaptoX May 27 '19 at 13:43
  • 1
    install_java.sh: 24: install_java.sh: Syntax error: "(" unexpected – Rajamohan S Jul 21 '19 at 03:09
  • It works fine for me with Oracle JDK 8u221, in fact the author recently updated the script on GitHub and added some improvements. I recommend posting the full details of your error as a separate question and include the script link and the distribution file you are trying to install, and the command line syntax you used. Your error appears to be a unique issue/question. – Don Jul 21 '19 at 17:53
  • I'm getting this exact error @RajamohanS. Did you manage to resolve it? Did you open a separate questions as Don suggested? – cellsuicide Jul 24 '19 at 01:43
  • Could it be related to the fact that I'm on windows linux subsystem @Don? – cellsuicide Jul 24 '19 at 02:00
  • 1
    @cellsuicide, Yes I resolved it by installing Open JDK version 8. Here is the link https://openjdk.java.net/install/ .. $ sudo apt-get install openjdk-8-jdk . OpenJDK is completely open source and can be used it freely. – Rajamohan S Jul 24 '19 at 11:16
  • I feel very strongly that it is outside the scope of the original question here to discuss other JDK's and environments. The original question is specifically how to install the Oracle JDK 8 on Ubuntu 19 since the PPA was removed. I've studied the install script in question and I have some comments regarding various OpenJDK packages and the Windows Linux subsystem, in relation to the said installer script, but these new questions about other JDK's and environments truly need their own threads since they are not relevant to this particular question. – Don Jul 25 '19 at 23:38
  • @RajamohanS you got that error because you ran it as sudo sh ./install_java.sh. A quick head install_java.sh will show that it is not a sh script, rather a bash script. – burito Aug 25 '22 at 15:50
0

Did you try installing headless jdk? as following?

sudo dpkg --configure -a
sudo apt-get install openjdk-8-jdk-headless -y --force-yes