I would like to run a JavaFX application on macOS that has only OpenJDK8:
** Edit ** The problem is that if I run the application with OracleSDK8 it works perfectly fine. But if I run it with OpenJDK8 I have problems when including JavaFX. For example:
FilterEditor.java:6: error: package javafx.scene.input does not exist
import javafx.scene.input.KeyEvent;
I'm using a Gradle script
jar {
if(JavaVersion.current() >= JavaVersion.VERSION_11){
apply plugin: 'org.openjfx.javafxplugin'
javafx {
version = "11"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.swing' ]
}
}else if(JavaVersion.current() != JavaVersion.VERSION_1_8){
throw new GradleException("This build script must be run with java 8 or a java version >= 11")
}
destinationDir = projectDir
manifest.attributes 'Main-Class': project.mainClassName
baseName = 'XXX'
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
But if fails if I use OpenJDK8.
There are several providers of OpenJDK + JavaFX. E.g. you can download that from Azul: https://www.azul.com/downloads/zulu-community/?version=java-8-lts&os=macos&architecture=x86-64-bit&package=jdk-fx
Nevertheless you should try to upgrade to a more recent version of Java/FX.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With