OpenJFX-11 does not work with OpenJDK-8

Bug #1799946 reported by Simon Levermann on 2018-10-25
182
This bug affects 37 people
Affects Status Importance Assigned to Milestone
openjfx (Ubuntu)
Undecided
Unassigned

Bug Description

In 18.10, the openjfx package now provides a version that is for use with the newly released Java 11. However, this openjfx package is incompatible with the still available openjdk-8-{jdk,jre} packages. The current reality is that many Java applications are not yet compatible with the Java module system, which is mandatory in Java 11. Due to this, it is currently impossible to run JavaFX applications (like JabRef in my case) which are not yet compatible with Java 11, unless I install Oracle's JDK 8 from external sources.

Would it be possible to supply an openjfx-8 package, similar to the openjdk-{8,11}-{jdk,jre}?

The version of openjfx is: 11+26-4
Version of Ubuntu is a fresh (not upgraded) install of 18.10.

ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: openjfx 11+26-4
ProcVersionSignature: Ubuntu 4.18.0-10.11-generic 4.18.12
Uname: Linux 4.18.0-10-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair nvidia_modeset nvidia
ApportVersion: 2.20.10-0ubuntu13
Architecture: amd64
CurrentDesktop: GNOME
Date: Thu Oct 25 14:39:06 2018
InstallationDate: Installed on 2018-10-11 (13 days ago)
InstallationMedia: Ubuntu 18.10 "Cosmic Cuttlefish" - Beta amd64 (20181011)
SourcePackage: openjfx
UpgradeStatus: No upgrade log present (probably fresh install)

Simon Levermann (sonofra) wrote :
information type: Public → Public Security
information type: Public Security → Public
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjfx (Ubuntu):
status: New → Confirmed
David Pyke (loftwyr) wrote :

Your app may be incompatible for other reasons.

The app I'm working with shows an inability to load the javaFX libraries until I loaded them from old debs I pulled from Debian. Then I prevented them from being updated.

JPT (j-p-t) wrote :

I've hidden my last comment because it's wrong.
I confirmed the author of this bug is right.

Yes, OpenJDK-8 cannot read the OpenJFX-11-Jars.
Yes, Java-8 apps do not run in Java-11.

But why does Jconsole report an empty/unavailable bootclasspath for OpenJDK-11?

I was able to copy the files from the openjfx package in 18.04 into my 18.10 manually and was able to launch Oracle SQLDeveloper which is what I needed the package for.

JPT (j-p-t) wrote :

workaround:

add bionic repo to your apt-sources:
deb http://de.archive.ubuntu.com/ubuntu/ bionic universe

maybe you should add "updates" or "security" repo too.

test with or immediately pin with the file below
sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2

pin the version by creating this file
$ cat /etc/apt/preferences.d/openjfx
Package: openjfx
Pin: release a=bionic
Pin-Priority: 1001

Package: libopenjfx-java
Pin: release a=bionic
Pin-Priority: 1001

JPT (j-p-t) wrote :
Simon Levermann (sonofra) wrote :

The problem with the "get oracle java" workaround is that oracle java is no longer free (as in beer):

https://www.oracle.com/technetwork/java/javaseproducts/overview/javasesubscriptionfaq-4891443.html

herrsaalfeld (herrsaalfeld) wrote :

On bionic, you will also have to downgrade libopenjfx-jni
```
sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2
```

Kristian Rink (kawazu) wrote :

Stumbled into this problem here as well both with a couple of internal Java applications and some FLOSS apps such as mediathekview (https://mediathekview.de/) in Germany.

Currently, Java 11 -> Java 8 downgrade or even installing both in parallel on any Ubuntu/Debian system works well, however for that to work with JavaFX applications it would be required to also be able to install different versions of openjfx - such as openjfx-11 for openjdk-11 and openjfx-8 for openjdk-8. Right now, the only working solution using the package repository is manually downgrading and pinning openjfx libs, which unfortunately also will prevent any option to provide updates to the openjfx-8 versions if ever needed.

Simon Levermann (sonofra) wrote :

As of a few weeks ago, Oracle will no longer supply free updates (security or otherwise) to oracle-jdk/jre-8. So now the only way to get Java 8-only applications, which still constitute a large portion is to use pinning of the openjfx package.

Kristian Rink (kawazu) wrote :

Yes, but the suggested approach ("Would it be possible to supply an openjfx-8 package, similar to the openjdk-{8,11}-{jdk,jre}?") would both fix this problem and make versioning of the openjdk- and openjfx- packages (which, despite being separate packages, are pretty closely tied to each other) immensely more concise. ;)

Simon Levermann (sonofra) wrote :

I'm aware of this, I was merely pointing out that the lack of oracle updates for java 8 now removes one of the possible workarounds, making the only still-working workaround.

I'm not familiar with the rules on the Ubuntu Bugtracker, but doesn't this effectively now make this a "security" bug? Since pinning disables updates, as well as Oracle no longer providing security updates for JDK version 8?

Kristian Rink (kawazu) wrote :

Hmmm, ok, I am unsure how Oracle and OpenJDK/JFX relate to each other, and whether the Open* variants will continue to see any community updates. The whole post-Java8-world still is a difficult thing to handle.

Simon Levermann (sonofra) wrote :

It looks like this isn't going to happen:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910407#15

pascal (deneaux) wrote :

This bug also effects the greenfoot project.

Since the PPA ppa:webupd8team/java is discontinued, there is no way to run greenfoot under Ubuntu.

I'm a teacher and it would be very helpful to have an openjfx-8 package so that i can run greenfoot.

```
$ greenfoot
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
 at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
 at bluej.Boot.main(Boot.java:193)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
 at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
 ... 13 more

```

pascal (deneaux) wrote :

ok. This works:

```
sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2
```

1proton (1proton) wrote :

Thank you pascal, herrsaalfeld and others! This solution worked also for me on Ubuntu 18.10 when using Mediathekview.

ps.:I had to reboot; maybe a logout/login would do it also

BR

herrsaalfeld (herrsaalfeld) wrote :

I would like to add that the proposed workaround to downgrade the openjfx packages is NOT a solution because no security updates will be available. The correct solution is to provide an openjfx-8 package as proposed by the TO or to roll back the openjfx package to version 8. The current openjfx package breaks the openjdk-8 package for Java FX applications and is unnecessary because openjfx-11 is a jar only solution that does not require package management by Ubuntu but can be fetched via maven or alike.

While this is not fixed, the packages have to be put on hold for updates

sudo apt install \
  openjfx=8u161-b12-1ubuntu2 \
  libopenjfx-java=8u161-b12-1ubuntu2 \
  libopenjfx-jni=8u161-b12-1ubuntu2
sudo apt-mark hold \
  openjfx \
  libopenjfx-java \
  libopenjfx-jni

Michael (miwait00) wrote :

@herrsaalfeld Instead of using apt-mark hold, I would recommend to rank the origin higher, so that in - the unlikely case - there will be an update published, it actually arrives.

/etc/apt/preferences.d/openjfx

Package: openjfx*
Pin: release a=bionic
Pin-Priority: 1001

Package: libopenjfx*
Pin: release a=bionic
Pin-Priority: 1001

thx @JPT

Although that works, its quite an hack. Can't we have something like openjdk-8-jfx, openjdk-8-jfx-source, openjdk-11-jfx, ...

Kristian Rink (kawazu) wrote :

> Although that works, its quite an hack. Can't we have something like openjdk-8-jfx,
> openjdk-8-jfx-source, openjdk-11-jfx, ...

It should possibly "just" be consistent. JavaFX *always* depends upon a particular JDK. Either make different versions of openjfx available for different openjdks (if there are different openjdk packages), or add *just* one openjdk and one openjfx package where it's easy to, say, downgrade openjd from 11 to 8 and be sure the installed openjfx package will either have a broken dependency or be downgraded as well. Current approach to handle this seems pretty much worst of both worlds. :|

Reuben Firmin (reubenf) wrote :

I attempted to compile JFX 8 from source manually, but it errors out. Can somebody try this and see if you can get any further? (I'm on 19.10).

```
# based on https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX, with updated gstreamer deps
sudo apt-get install ksh bison flex gperf libasound2-dev libgl1-mesa-dev \
    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libjpeg-dev \
    libpng-dev libx11-dev libxml2-dev libxslt1-dev libxt-dev \
    libxxf86vm-dev pkg-config x11proto-core-dev \
    x11proto-xf86vidmode-dev libavcodec-dev mercurial \
    libgtk2.0-dev libgtk-3-dev \
    libxtst-dev libudev-dev libavformat-dev cmake ruby

# most recent openjfx 8 build. theoretically openjfx 9 is compatible with jdk N-1 (https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX#BuildingOpenJFX-OpenJDK), but their gradle build blocks 9 from compiling on openjdk 8

git clone --branch 8u51-b09 https://github.com/openjdk/jfx.git

# their build requires gradle 1.8, which is from 2013 :(

# download 1.8 from: https://gradle.org/releases/

cd jfx
~/Downloads/gradle-1.8/bin/gradle
```

After doing this, I get:

```
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':graphics:ccLinuxGlass'.
> Could not call NativeCompileTask.compile() on task ':graphics:ccLinuxGlass'
```

Googling for this error takes me to: http://mail.openjdk.java.net/pipermail/openjfx-dev/2015-April/017156.html

I have a much more recent version of gcc than the answer references, so it _seems_ like this shouldn't be an issue. But it appears that OpenJDK 8 that's installed on Ubuntu 19.10 was probably built using an older version of gcc without this header? Is there a workaround short of compiling OpenJDK 8?

Is there anyway we could increase the priority of this issue? The workaround of pinning to 8u161-b12-1ubuntu2 because that package no longer exists. There are MANY codebases out there that are still stuck in Java 8 and so far it seems that the only way to get openJFX with OpenJDK 8 is to compile it from source, which is not trivial.

FYI, so far I have not found a way to compile openJFX 8 from source on Ubuntu 20.4. I've created this bug on openJFX to hopefully resolve that. https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8245065

Kristian Rink (kawazu) wrote :

Personally, I have given up on that and moved to using sdkman (https://sdkman.io) for handling Java variants, this so far seems the best / most reliable way to get different Java versions (including 8.x series) to work on recent Linux distributions. Java packaging in Debian-based distributions always has been weird, and JavaFX and the changes related to the way it's supposed to be distributed don't make things easier here.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.