Closed hohonuuli closed 5 years ago
I started a java9
branch. Some libraries (looking at you GSON), aren't Java 9 friendly yet.
Changed title of this issue. Re-targeting Java 11 which is the next long-term Java release due out in September, 2018. Note that Java 11 does not include JavaFX anymore. Perhaps can build VARS using the new Java module system
Java 11, the next long-term release of Java will be out in September. Java 8 will EOL'd in January. Sometime between those two milestones, I'll make Java 11 the target JDK and merge those changes into Master. Outstanding issues:
Some references to help with modularizing the build:
I am using javapackager to create nice applications for Linux and Mac. javapackager has been failing for me on Window. As of Java 11, it's been removed. However, in java 12 or 13 there will be a new packaging tool. It's out for code review now. The JEP page is at https://openjdk.java.net/jeps/343
Here's a no article that describes using a port of javapackager for Java 11 to package a JavaFX app ... https://medium.com/@adam_carroll/java-packager-with-jdk11-31b3d620f4a8
Also, look into dropping use of jax-rs and use the new JDK 11 HTTP Client instead
OracleJDK 8 has been EOL'd. I've run tests with:
Just for reference ... https://www.pluralsight.com/resource-center/webinars/migrating-beyond-java-8/thank-you
JPackage references ... Looks like it may be included in Java 13:
I've begun the port to Java 11. I'm modularizing the project (jlink) and splitting out modules so that I can reuse some of the code in other apps. Until I get the port stabilized it's in a private repo at https://bitbucket.org/mbari/vars-annotation-prj
gradle jlink
builds a distribution. But running vars-annotation
gives the following:
Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package fxml in both module vars.annotation.merged.module and module org.mbari.vars.ui
gradle run
gives the following error:
2019-07-13 00:55:34 [JavaFX-Launcher] WARN org.mbari.m3.vars.annotation.AppConfig - Unable to find a config value at path annotation.service.url
Jul 13, 2019 12:55:34 AM com.google.inject.internal.MessageProcessor visit
INFO: An exception was caught and reported. Message: java.lang.NullPointerException
java.lang.NullPointerException
at org.mbari.vars.services/org.mbari.vars.services.RetrofitServiceFactory.<init>(RetrofitServiceFactory.java:36)
at org.mbari.vars.services/org.mbari.vars.services.impl.annosaurus.v1.AnnoWebServiceFactory.<init>(AnnoWebServiceFactory.java:26)
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.MBARIInjectorModule.configureAnnotationService(MBARIInjectorModule.java:53)
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.MBARIInjectorModule.configure(MBARIInjectorModule.java:42)
at com.google.guice@4.2.2/com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
at com.google.guice@4.2.2/com.google.inject.spi.Elements.getElements(Elements.java:103)
at com.google.guice@4.2.2/com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)
at com.google.guice@4.2.2/com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.guice@4.2.2/com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.guice@4.2.2/com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.guice@4.2.2/com.google.inject.Guice.createInjector(Guice.java:59)
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.Initializer.getInjector(Initializer.java:139)
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.Initializer.getToolBox(Initializer.java:59)
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.App.init(App.java:71)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:824)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
TODO: Remember to migrate tests over to java 11 branch.
I've removed Guice and replaced it with some manual wiring. I am also in the process of removing fontawesomefx and replacing it with Ikonli. Guice annd fontawesomefx are not playing well with Java 11, although I just found Fontawesome 11, which would probably work. In any case I'm refactoring the icons to be generated from a single class rather than scattered throughout the code.
JFoenix is not playing well with Java 11. I'm getting the following error:
Caused by: java.lang.IllegalAccessError: class com.jfoenix.skins.JFXTabPaneSkin (in module com.jfoenix) cannot access class com.sun.javafx.scene.control.behavior.TabPaneBehavior (in module javafx.controls) because module javafx.controls does not export com.sun.javafx.scene.control.behavior to module com.jfoenix
at com.jfoenix/com.jfoenix.skins.JFXTabPaneSkin.<init>(JFXTabPaneSkin.java:86)
To migrate from FXLauncher — which doesn't work past Java 8 — check out my replacement framework https://github.com/update4j/update4j which is quite similar in design but with a completely different mindset.
@mordechaim Thanks for the pointer to update4j. I'll take at the demos.
gradle run
works now. But getting errors like:
2019-07-25 20:38:39 [JavaFX Application Thread] ERROR org.mbari.m3.vars.annotation.App - Exception in thread [JavaFX Application Thread]
java.lang.RuntimeException: Failed to load /fxml/UserEditorPane.fxml
at org.mbari.vars.ui/org.mbari.vars.ui.util.FXMLUtils.newInstance(FXMLUtils.java:28)
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.ui.userdialog.UserEditorPaneController.newInstance(UserEditorPaneController.java:108)
2019-07-25 20:38:17 [JavaFX Application Thread] WARN org.mbari.vars.services.RetrofitWebService$1 - Exception thrown when making a REST call
java.lang.IllegalArgumentException: Path parameter "name" value must not be null. (parameter #1)
for method VamWebService.findVideoNamesByVideoSequenceName
at retrofit2@2.6.0/retrofit2.Utils.methodError(Utils.java:52)
at retrofit2@2.6.0/retrofit2.Utils.methodError(Utils.java:42)
at retrofit2@2.6.0/retrofit2.Utils.parameterError(Utils.java:61)
at retrofit2@2.6.0/retrofit2.ParameterHandler$Path.apply(ParameterHandler.java:111)
at retrofit2@2.6.0/retrofit2.RequestFactory.create(RequestFactory.java:117)
at retrofit2@2.6.0/retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:192)
at retrofit2@2.6.0/retrofit2.OkHttpCall.enqueue(OkHttpCall.java:100)
at org.mbari.vars.services/org.mbari.vars.services.RetrofitWebService.sendRequest(RetrofitWebService.java:26)
at org.mbari.vars.services/org.mbari.vars.services.impl.vampiresquid.v1.VamService.findVideoNamesByVideoSequenceName(VamService.java:119)
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.ui.mediadialog.VideoBrowserPaneController.lambda$getVideoSequenceListView$7(VideoBrowserPaneController.java:145)
Also, anything that uses a service provider is failing. Look into what's needed to get services working with JPMS.
Getting closer. Current errors in the settings panes due to missing fontawesomfx ... maybe I used it in an FXML file?
2019-07-25 21:24:21 [JavaFX Application Thread] ERROR org.mbari.m3.vars.annotation.App - Exception in thread [JavaFX Application Thread]
java.util.ServiceConfigurationError: org.mbari.m3.vars.annotation.mediaplayers.MediaControlsFactory: Provider org.mbari.m3.vars.annotation.mediaplayers.vcr.MediaControlsFactoryImpl could not be instantiated
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:581)
[...]
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.mediaplayers.MediaPlayers.getSettingsPanes(MediaPlayers.java:53)
[...]
Caused by: java.lang.NoClassDefFoundError: de/jensd/fx/glyphs/GlyphIcons
at org.mbari.vars.ui/org.mbari.m3.vars.annotation.mediaplayers.vcr.MediaControlsFactoryImpl.<init>(MediaControlsFactoryImpl.java:58)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[...]
Caused by: java.lang.ClassNotFoundException: de.jensd.fx.glyphs.GlyphIcons
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
I get the following error when packaging:
Compiling module-info from /Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/tmpjars/vars.annotation.merged.module...
Starting process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/javac''. Working directory: /Users/brian/workspace/vars-annotation/org.mbari.vars.ui Command: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/javac -p /Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/tmpmerged:/Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/jlinkjars -d /Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/tmpmodinfo /Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/tmpjars/vars.annotation.merged.module/module-info.java
Successfully started process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/javac''
/Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/tmpjars/vars.annotation.merged.module/module-info.java:315: error: module not found: javafx.graphics
requires javafx.graphics;
^
/Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/tmpjars/vars.annotation.merged.module/module-info.java:321: error: module not found: javafx.base
requires javafx.base;
^
/Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/tmpjars/vars.annotation.merged.module/module-info.java:325: error: module not found: javafx.controls
requires javafx.controls;
^
3 errors
Look into sorting this out in the merged module.
The above error was caused by Medusa. Which was throwing some weird ASM7 error while gradle was preparing the modules. When I removed medusa it proceeded to the next step.
Getting a new error:
Gradle is executing this:
/Users/brian/workspace/vars-annotation/org.mbari.vars.ui Command: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/jlink -v --bind-services --strip-debug --compress 2 --no-header-files --no-man-pages --module-path /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/jmods/:/Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/jlinkjars --add-modules org.mbari.vars.ui --output /Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/image
Then producing this error:
Error: Two versions of module javafx.graphics found in /Users/brian/workspace/vars-annotation/org.mbari.vars.ui/build/jlinkbase/jlinkjars (javafx-graphics-11.0.2-mac.jar and javafx-graphics-11.0.2-linux.jar)
Error: Two versions of module javafx.graphics found
The resolution to this was to exclude the transitive javafx dependencies from controlsfx and rxjavafx like so:
implementation('io.reactivex.rxjava2:rxjavafx') {
exclude group: 'org.openjfx', module: 'javafx-base'
exclude group: 'org.openjfx', module: 'javafx-controls'
exclude group: 'org.openjfx', module: 'javafx-graphics'
because("If not excluded we end up with both mac and linux javafx jars which cause jlink to fail")
}
implementation('org.controlsfx:controlsfx') {
exclude group: 'org.openjfx', module: 'javafx-base'
exclude group: 'org.openjfx', module: 'javafx-controls'
exclude group: 'org.openjfx', module: 'javafx-graphics'
because("If not excluded we end up with both mac and linux javafx jars which cause jlink to fail")
}
Annotation::getVisibleRows
call internal JavaFX methods. These methods are hidden in Java 9+, so this code won't compile past Java 8. I have a partial solution in TableViewExt but it seems to cause GUI issues (Hangs, crashes). I need to investigate this.