Closed RationalityFrontline closed 3 years ago
I made a temporary solution by reverting the Automatic-Module-Name:
Add the following content to your build.gradle.kts
afterEvaluate {
configurations.runtimeClasspath.get().filter {
it.name.startsWith("javafx") && it.name.endsWith("${javafx.version}.jar")
}.files.forEach { jarFile ->
val tmpDir = file("$buildDir/tmp/jfx_empty_jar")
delete(tmpDir)
tmpDir.resolve("META-INF/MANIFEST.MF").apply {
ensureParentDirsCreated()
val splits = jarFile.name.split('-')
val moduleName = "${splits[0]}.${splits[1]}Empty"
writeText(
"""
Manifest-Version: 1.0
Automatic-Module-Name: $moduleName
""".trimIndent()
)
}
zipTo(jarFile, tmpDir)
}
}
There is a new released version for JavaFX which reverted that feature https://gluonhq.com/products/javafx/openjfx-17-release-notes/#17.0.0.1
With JavaFx 17 or greater, runing javafx applications via the binary distribution generated by
gradlew install
will fail with the following error message:This is because commit https://github.com/openjdk/jfx/commit/02b078a8a00803e03f4d2b5f06552f88dd0d5c00 removed the Automatic-Module-Name of the empty jar, which made both jars recognized as the same module.
The javafx-gradle-plugin should remove empty jars from the module path.
Sample project that can reproduce the issue: https://github.com/RationalityFrontline/jfx-test