edvin / fxlauncher

Auto updating launcher for JavaFX Applications
Apache License 2.0
713 stars 110 forks source link

Unable to load class 'javax.xml.bind.JAXB'. #123

Closed yatschki closed 6 years ago

yatschki commented 6 years ago

Hi guys,

first of all sorry for my bad English 😅

I try to figure out how to make the FXlauncher compatible with JDK 10. When I try to do it with JDK 1.8 everything is okay, except the native installer. The task creates the installer but when I try to run the app it says:

logging to /var/folders/ww/gmr01s910kn1nmx3tzdpdjqw0000gn/T//fxlauncher.log Exception in thread "FXLauncher-Thread" java.lang.NoClassDefFoundError: javax/xml/bind/JAXB at fxlauncher.AbstractLauncher.syncManifest(AbstractLauncher.java:201) at fxlauncher.AbstractLauncher.updateManifest(AbstractLauncher.java:92) at fxlauncher.Launcher.lambda$start$0(Launcher.java:137) at java.base/java.lang.Thread.run(Thread.java:844) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXB at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) ... 4 more

But if I change it to JDK 10 these tasks don't work anymore:

copyAppDependencies generateApplicationManifest embedApplicationManifest generateNativeInstaller

For example: 00:38:53: Executing task 'generateApplicationManifest'...

Task :compileJava UP-TO-DATE Task :processResources UP-TO-DATE Task :classes UP-TO-DATE Task :jar UP-TO-DATE Task :copyAppDependencies Task :generateApplicationManifest FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 0s 5 actionable tasks: 2 executed, 3 up-to-date Unable to load class 'javax.xml.bind.JAXB'. Possible causes for this unexpected error include:

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes. 00:38:53: Task execution finished 'generateApplicationManifest'.

Do I miss something ?

yatschki commented 6 years ago

here is my build.gradle file

apply plugin: 'java' apply plugin: 'no.tornado.fxlauncher'

group 'no.tornado' version '1.0'

sourceCompatibility = 1.8 [compileJava, compileTestJava].options.encoding = 'UTF-8'

if (!hasProperty('mainClass')) { ext.mainClass = 'main.Main' }

buildscript { repositories { mavenCentral() } dependencies { classpath 'no.tornado:fxlauncher-gradle-plugin:1.0.16' } }

fxlauncher { applicationVendor 'My Company' applicationUrl 'xxxx' applicationMainClass 'main.Main' acceptDowngrade false }

repositories { mavenLocal() mavenCentral() }

dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' compile 'com.h2database:h2:1.4.196' compile 'com.google.code.gson:gson:2.8.2' compile files('libs/ObiLibrary.jar') compile 'org.controlsfx:controlsfx:8.40.12' }

jar { manifest.attributes 'Main-Class': 'main.Main' from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }

TravFitz commented 6 years ago

Hi Yatschki,

The issue lies in the version of JDK, if you compile it in JDK 8 you will not have an issue, the reason for this is from JDK 9 and up Oracle have removed access to internal API's and as that particular module was one of them they no longer have access to it. This may mean that Edvin and co will need to make a work around for the XML handlers it may mean writing their own handler using javax.xml.stream modules.

Hope that helps explain the situation, I am sure they guys are looking into it however.

edvin commented 6 years ago

Yeah, that’s correct. TornadoFX is not yet compatible with JDK9, but we are working on it in a separate branch :)