edvin / fxlauncher

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

add compile time dependencies for Java 9+ #151

Open xzel23 opened 5 years ago

xzel23 commented 5 years ago

This adds the java.xml.bind dependency for Java 9+ and also JavaFX for JDK 11+. I can now compile FXLauncher under both JDK 8 and 11. The resulting jar should work as before on Java 8. I cannot test Java 9 and 10, but to actually run on Java 11, more tweaks are needed.

I tried to test this with the fxldemo project, and both jars (= compiled with JDK 8 vs JDK 11) work the same when run under JDK 8. I get an error "WARNING: Error during Update Manifest phase" when I replace the original fxlauncher.jar with the new SNAPSHOT version though. But I see the same error when replaing with the original SNAPSHOT version (not containing my changes), so this seems unrelated.

When running on JDK 11, I get this error:

Error: Could not find or load main class fxlauncher.Launcher
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

I will look into the issue with running under Java 11 later.

edvin commented 5 years ago

Great start. I will wait with merging until it works with J11, OK?

xzel23 commented 5 years ago

Ok, works now (still getting java.lang.IllegalArgumentException: Unable to retrieve embedded or remote manifest.).

On Java 11, using jaxb pulls in a lot of dependencies that are required on the runtime classpath. I think XML should either be required by JSON or the code rewritten to use org.w3c instead which is stiill part of the JDK.

That's bout what I can do for now. I think next problem will be the one remaining use of internal API. But I can only continue there once the "Unable to retrieve embedded or remote manifest" issue is solved.

More detail on what I did and how to run on Java 11 (did not try on Java 9 and 10 because I don't have them installed and both have already reached EOL):

To run in Java 8:

java -jar ./fxlauncher.jar

To run in Java 11:

xzel23 commented 5 years ago

OK, I found out why the manifest could not be loaded. I did not use the --app parameter. Now that I do, an NPE is thrown later on.

I think I learned enough about FxLauncher to fix the remaining problems. I will let you know when everything works and this is ready and working in both Java 8 and 11. Please wait with merging.

xzel23 commented 5 years ago

After I have looked deeper into this, this is where we are now:

How to run fxldemo in Java 11 (change paths accordingly):

    java --module-path=/Users/axel/Development/libs/javafx-sdk-11.0.2/lib \
        --add-modules=javafx.controls,javafx.web,javafx.fxml,javafx.base \
        --add-opens=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
        --add-opens=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED
        --class-path=./fxlauncher.jar:../../lib/jaxb-api-2.3.0.jar:../../lib/jaxb-api-2.3.0.jar:../../lib/jaxb-core-2.3.0.jar::../../lib/jaxb-impl-2.3.0.jar:../../lib/activation-1.1.1.jar fxlauncher.Launcher \
        --app=app.xml
aarighi commented 4 years ago

Hi! Thanks for the great work, but since this thread has not been updated in a while I need to ask: is anyone still working on this? Is this ever going to be merged in FXLauncher?

Thanks again (:

edvin commented 4 years ago

I don't have time to work on this at the moment. Eventually I'll update it when I need to use JDK13+ myself, but in the mean time anyone is free to contribute :)