9

I would like to install Oracle Java 8 on my Ubuntu 18.04 using packages. I already added the apt-repository, but when trying to install it says package is not available. All I do is:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Then it says:

Package oracle-java8-installer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'oracle-java8-installer' has no installation candidate

Maybe the package has already been deleted and is not available now?

Orbit09
  • 205
  • 2
  • 6
  • 13
  • Normally, you use a package because you want it to be part of updates, etc. But Java 8 is years out of date. If you want to install something that out of date, you're probably best off doing it directly, downloading the installer from Oracle and running it directly, not via `apt`. – T.J. Crowder Apr 20 '19 at 08:46
  • Oracle doesn't allow me to downlaod an installer without registering :( if there was any other source to download it manually, I would appreciate it. – Orbit09 Apr 20 '19 at 08:51
  • 1
    Yeah, I just use throw-away email addresses for that. – T.J. Crowder Apr 20 '19 at 08:54
  • (Well, actually, I use my Oracle account. But in similar situations, I just use a throw-away email.) – T.J. Crowder Apr 20 '19 at 09:02
  • Okay, how to install the Oracle package? I downloaded the tar.gz, then converted to a .deb, installed the package but no java folder was created in /usr/lib/jvm/ – Orbit09 Apr 20 '19 at 09:47
  • I think this method of installation has been discontinued following Oracle's change of terms on 4/16/2019. https://launchpad.net/~webupd8team/+archive/ubuntu/java – Gabriel Kohen May 03 '19 at 15:49

4 Answers4

3

sudo apt install openjdk-8-jdk openjfx should do the trick. It will get you JavaFX for OpenJDK.

Read more at https://askubuntu.com/questions/1091157/javafx-missing-ubuntu-18-04

Doc
  • 10,831
  • 3
  • 39
  • 63
  • I have even openjfx, but my programs still don't work. ``` openjdk-8-jdk is already the newest version (8u191-b12-2ubuntu0.18.04.1). openjfx is already the newest version (11.0.2+1-1~18.04.2). ``` – Orbit09 Apr 20 '19 at 09:15
  • did you set the SDK properly. Read the answers in the link – Doc Apr 20 '19 at 09:16
  • I already set the Netbeans settings, but it still cannot find my JavaFX. – Orbit09 Apr 20 '19 at 09:45
1

Others have mentioned to install openjdk-8.
After that---> Get jfxrt.jar file from https://github.com/qweasdzxcpoi/JavaFX
Do sudo nautilus.
And put it in your /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext
This personally worked for me when all the other commands were not working for some reason idk.
After that rebuild your project.

Rahul
  • 576
  • 1
  • 5
  • 9
  • Wow. Thank you, the errors disappeared, Netbeans can now find JavaFX. But when I try to build a Maven project, it fails with the error `Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (unpack-dependencies) on project fx-cca-simul: Command execution failed. Cannot run program "/usr/lib/jvm/java-8-openjdk-amd64/jre/../bin/javafxpackager" ` – Orbit09 Apr 20 '19 at 16:58
  • 1
    I'm sorry I can't help you with that I have no experience of maven projects, just worked on JavaFX. While running my project I did not use maven. – Rahul Apr 20 '19 at 17:42
  • Do you know where to put the `jfxrt.jar` file in openjdk-11? – Orbit09 Apr 21 '19 at 14:47
  • 1
    There is no `jre` for `openjdk-11` but there is a bypass wround it here https://stackoverflow.com/questions/52714672/is-there-an-openjdk-11-jre – Rahul Apr 21 '19 at 14:53
  • I wouldn't trust a JAR from a random GitHub account with a name that just looks like some keys were mashed together. – Mark Rotteveel Aug 16 '19 at 07:03
0

You need to be using sudo apt install openjdk-8-jre. Currently you have only installed an installer.

TheChubbyPanda
  • 1,721
  • 2
  • 16
  • 37
0
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-8-jdk openjdk-8-jre

This still works and is enough to run Jenkins.

Andronicus
  • 25,419
  • 17
  • 47
  • 88