I have a Java application which uses javaFX to process images (using the javafx.scene.image.Image and some related functionality, and instantiating an javafx/embed/swing/JFXPanel object to force JavaFX to initialise). I'm trying to run this application on an Oracle free server running Oracle Linux 8.6 with Oracle Java 1.8.0_351 (OpenJDK and Oracle Java 19 give errors relating to JavaFX not being present). I've compiled my application into a JAR (compiling for Java 1.8.0_301 using Oracle Java on Windows). However, on the server, this doesn't work; I get the exception java.lang.UnsupportedOperationException: Unable to open DISPLAY
.
This question's answer suggests using xvfb:
Deploy JavaFX on Ubuntu server without display
I've tried this, but get a "GLX version 1.3 or higher is required" error instead.
Is there a solution for running JavaFX with Oracle Linux?
What I've tried:
I've tried with two different OSes available with Oracle free;
Oracle Linux 8.6
OpenJDK was installed with sudo dnf install java-1.8.0-openjdk-devel.x86_64
.
Running the jar gives the NoClassDefFoundError
error.
I couldn't work out how to install javafx with dnf on Oracle Linux.
I decided to give Oracle Java a go; OpenJDK was unlinked with sudo unlink /etc/alternatives/java
.
The Oracle jdk 19 was downloaded and installed with sudo rpm -ivh jdk-19_linux-x64_bin.rpm
. Running the jar (with java -jar MyJar.jar
) still gives the same error.
I tried uninstalling that (with sudo dnf remove jdk-19
) and openJDK (with sudo dnf remove java
) and installing Oracle Java 1.8.0 from a .rpm file. I then get an java.lang.UnsupportedOperationException: Unable to open DISPLAY
error.
Xvfb was installed using sudo dnf install xorg-x11-server-Xvfb
. xdpyinfo was installed using sudo dnf install xdpyinfo
.
Xvfb was started using export DISPLAY=:99
and sudo xdpyinfo -display $DISPLAY > /dev/null || Xvfb $DISPLAY -screen 0 1024x768x16 &
(taken from here: https://unix.stackexchange.com/a/297882 )
When running the JAR, I then get the exception
ES2 Prism: Error - GLX extension is not supported
GLX version 1.3 or higher is required
java.lang.UnsupportedOperationException: Internal Error
Canonical Ubuntu 22.04 Minimal
OpenJDK was installed with sudo apt-get install openjdk-8-jdk
.
Running the jar gives the NoClassDefFoundError
error.
OpenJFX was installed with sudo apt-get install openjfx
. Same error.
I tried running the JAR with --module-path
argument pointing to /usr/share/openjfx/lib/
; --module-path
is an unrecognised option with Java 8.
I upgraded to the latest openjdk sudo apt-get install openjdk
. After this I'm able to use --module-path
.
I tried running the JAR with java --module-path /usr/share/openjfx/lib/ --add-modules javafx.controls,javafx.base,javafx.graphics,javafx.swing -jar MyJar.jar
(I'm not sure which modules correspond to which packages...). This causes a java.lang.UnsupportedOperationException: Unable to open DISPLAY
error.