JavaFX program only runs everywhere except Raspberry Pi 3 - java

I've written a program in IntelliJ Idea using JavaFX. It uses a Webkit property to display an html page in a JavaFX Window. My Program runs on every Device (Windows and Linux) except the Raspberry Pi 3b it should be running on. When I try it gives me this error:
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.UnsatisfiedLinkError: no jfxwebkit in java.library.path: [/usr/java/packages/lib, /lib, /usr/lib]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2673)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:162)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
at javafx.web/com.sun.webkit.WebPage.lambda$static$1(WebPage.java:134)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.web/com.sun.webkit.WebPage.<clinit>(WebPage.java:133)
at javafx.web/javafx.scene.web.WebEngine.<init>(WebEngine.java:847)
at javafx.web/javafx.scene.web.WebEngine.<init>(WebEngine.java:832)
at javafx.web/javafx.scene.web.WebView.<init>(WebView.java:260)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1019)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
at com.example.demo.Application.start(Application.java:32)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:456)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:429)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:428)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
... 1 more
I have tried installing various JDK's and JavaFX. I've tried OpenJFX, Bellsoft Full JDK and Gluon jfx-1.17.0.2. No matter which one i tried it all showed the same result. I had trouble finding a proper sdk due to the 32Bit Arm architecture. (all other devices used 64bit)
I have added them with module-path and added all required modules whilst opening the .jar but it did not do anything.

According to https://bell-sw.com/pages/liberica-release-notes-19/ even for the latest version of the FULL JDK "Java FX Webkit - does not work". I am not aware of any 32 bit distro for the raspi which would support Webkit.

Related

IllegalStateException: zip file closed

I have a Java desktop application that was running fine in Java 1.8; I'm upgrading to Java 1.11 for a client, and am getting the above error.
Full stacktrace:
java.lang.ExceptionInInitializerError
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:442)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:326)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:309)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:290)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:274)
at drivingrecordtool.file.DrivingRecordPDFTextReader.getOCRText(DrivingRecordPDFTextReader.java:152)
at drivingrecordtool.file.DrivingRecordPDFTextReader.getText(DrivingRecordPDFTextReader.java:46)
at drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:78)
at drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:1)
at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: zip file closed
at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:913)
at java.base/java.util.zip.ZipFile.getEntry(ZipFile.java:348)
at java.base/java.util.zip.ZipFile$1.getEntry(ZipFile.java:1130)
at java.base/java.util.jar.JarFile.getEntry0(JarFile.java:586)
at java.base/java.util.jar.JarFile.getEntry(JarFile.java:516)
at java.base/sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:131)
at java.base/java.util.jar.JarFile.getJarEntry(JarFile.java:478)
at java.base/jdk.internal.loader.URLClassPath$JarLoader.getResource(URLClassPath.java:945)
at java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:315)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:455)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:83)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
... 15 more
The Tesseract library has a Java wrapper that I've used for months successfully but now seems involved in the error, whatever it is. I've been using the same DLL and started getting this failure, and I've updated the Tesseraact DLL and the wrapper to their latest version.
More puzzling is that the application runs fine within eclipse, and only fails like this when run from a command line (Windows 10). I have uninstalled and reinstalled the DLL a couple of times, rebooted the machine each time, and am running out of things to try. I went through the entire Maven dependencies list and deleted all files found there from my repository, then refreshed the eclipse project to reload all the files in the list.
I saw one suggestion of placing a breakpoint in ZipFile, but that won't help since the problem does not appear in eclipse.
I'm willing to upgrade the Java further, but it would be nice, first, to have some knowledge of what the problem is so that I have some confidence that will fix it.
Can someone suggest what might be wrong, or strategies to find out?

kaptDebugKotlin crashes when building with Java Version 11 or higher

I'm getting an IllegalStateException/NoClassDefFoundError when trying to run the command ./gradlew :data:test on my project (https://github.com/guger/MoneyBook). This error does occur when I'm using a Java Version higher than 11. I'm not able to use the jdk bundled into the IDE, since robolectric requires Java 9 or higher, when testing against Android Q and Java 9 does not work as it provides it's version string in a format which is not recognized by robolectric.
java.lang.IllegalStateException: failed to analyze: java.lang.NoClassDefFoundError: com/sun/tools/javac/file/BaseFileObject
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:56)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:182)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1558)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:689)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:835) Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/file/BaseFileObject
at org.jetbrains.kotlin.kapt3.base.javac.KaptJavaFileManager.shouldBeFiltered(KaptJavaFileManager.kt:69)
at org.jetbrains.kotlin.kapt3.base.javac.KaptJavaFileManager.list(KaptJavaFileManager.kt:49)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:737)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:674)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:554)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:299)
at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
at jdk.compiler/com.sun.tools.javac.code.Symbol$PackageSymbol.members(Symbol.java:1131)
at jdk.compiler/com.sun.tools.javac.code.Symtab.listPackageModules(Symtab.java:834)
at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:345)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:535)
at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:286)
at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:301)
at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:577)
at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:561)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1066)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:66)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:35)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:230)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:188)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:99)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:81)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:555)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:546)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177)
... 23 more Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.file.BaseFileObject
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 52 more
Does anyone experience a similar behaviour when running Android Projects on Java 11/12/13?
I had a similar issue recently regarding to JDK9.
I used this library which solved the problem:
"com.github.pengrad:jdk9-deps:1.0"
Unfortunately, this is due to the lacking support of JDK 13 in Gradle 5.x.
Gradle 6.0 will support Java 13 (https://docs.gradle.org/6.0/release-notes.html).
Until then, there's no other possibility than waiting.

JAXBException when running lint test

I have an app that pass a lint test on circleCI, but fail on local machine with the following error
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3090)
at java.base/java.lang.Class.getConstructor0(Class.java:3295)
at java.base/java.lang.Class.newInstance(Class.java:532)
at org.jetbrains.kotlin.cli.jvm.plugins.ServiceLoaderLite.loadImplementations(ServiceLoaderLite.kt:50)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension$loadProcessors$efficientProcessorLoader$1.doLoadProcessors(Kapt3Extension.kt:83)
at org.jetbrains.kotlin.kapt3.base.ProcessorLoader.loadProcessors(ProcessorLoader.kt:45)
at org.jetbrains.kotlin.kapt3.base.ProcessorLoader.loadProcessors$default(ProcessorLoader.kt:28)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.loadProcessors(Kapt3Extension.kt:88)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:171)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:98)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:82)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:384)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:70)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:375)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:123)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:131)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:103)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:442)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:1027)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:1069)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:1026)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:441)
at jdk.internal.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 48 more
I do not use JAXB and I have no idea where does this come from. More frustrating is I can build my app without any error.
I have tried the solutions in the following links, but none of them works for my case.
https://www.concretepage.com/questions/556
How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
Has anyone experienced similar issues?
The JAXB APIs are considered to be J2EE APIs, therefore not present default class path in Java SE 9. In JDK 11 they are completely removed. But, these Java EE APIs that were provided in JDK 6/7/8 are still in the JDK.
Edit 10/2020:
I ran into this issue again some time ago when CircleCi update their java image from jdk8 to jdk11. I was able to solve this issue by updating the Gradle tool. Looks like in the latest version of Gradle lint no longer use JAXB APIs.
Old answer: Today I finally solve this issue. Here is what I did.
I attempted to solve this issue by reinstalling Android Studio 3.4. However I couldn't even start up Android Studio and I ran into this
java.lang.RuntimeException:
com.intellij.ide.plugins.PluginManager$StartupAbortedException:
Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
Then I looked for answers and came across this page
[Can't start Android Studio][1]
[1]: https://superuser.com/questions/1391452/cant-start-android-studio
I reverted back to use jdk 8.
Android Studio 3.4 finally started up, and JAXBException was gone.

How to run ControlsFX sample application using Java 11 and JavaFX 11

ControlsFX website says:
If you want to play with the ControlsFX sample application, simply
download the ControlsFX release and run the following command on the
command prompt (be sure to replace the * with the actual version
number of FXSampler and ControlsFX-samples):
java -jar controlsfx-samples-*.jar
I've downloaded ControlsFX 9.0.0 which is said to be for users of Java 9 and later.
When I run java -jar controlsfx-samples-9.0.0.jar I get
Error: Could not find or load main class fxsampler.FXSampler
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
But that's OK, as according to Run HelloWorld using JavaFX 11 guide, I have to add modules.
So I try java --module-path "C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls -jar controlsfx-samples-9.0.0.jar and I get
Missing JavaFX application class fxsampler.FXSampler
I execute all commands from controlsfx-9.0.0 directory which contains controlsfx-9.0.0.jar, controlsfx-samples-9.0.0.jar and fxsampler-1.0.10.jar.
Output of java -version for me is:
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
Any comments and suggestions are appreciated.
Thanks in advance.
EDIT:
After following Slaw's advice and running java --module-path "C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls,javafx.fxml,javafx.web -jar controlsfx-samples-9.0.0.jar I get
Initialising FXSampler sample scanner...
Discovering projects...
Found project 'ControlsFX', with sample base package 'org.controlsfx.samples'
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class impl.org.controlsfx.version.VersionChecker
at org.controlsfx.control.ControlsFXControl.(ControlsFXControl.java:35)
at org.controlsfx.control.WorldMapView.(WorldMapView.java:93)
at org.controlsfx.samples.HelloWorldMapView.(HelloWorldMapView.java:55)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at fxsampler.util.SampleScanner.discoverSamples(SampleScanner.java:86)
at fxsampler.FXSampler.start(FXSampler.java:106)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Exception running application fxsampler.FXSampler
Fixed in PR #720. So new Maven artifacts will incorporate the fix.
Full issue history can be seen here.

Error when launching Java FX application on a headless Linux RedHat system

Trying to launch a java FX application on a Linux system using X. I get the following stack trace. After a bunch of googling and installing various packages, I am at a loss. Any thoughts?
java -jar tacoma_testing.jar
Prism-ES2 Error : GL_VERSION (major.minor) = 1.4
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.javafx.main.Main.launchApp(Main.java:698)
at com.javafx.main.Main.main(Main.java:871)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: /projects/tacoma/tacoma_regression_testing/jdk1.7.0_25/jre/lib/amd64/libglass.so: libgio-2.0.so.0: cannot open shared object file: No such file or directory
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:281)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:124)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:163)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.UnsatisfiedLinkError: /projects/tacoma/tacoma_regression_testing/jdk1.7.0_25/jre/lib/amd64/libglass.so: libgio-2.0.so.0: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1957)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1882)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1061)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:200)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:88)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:31)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:73)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:80)
at com.sun.glass.ui.gtk.GtkPlatformFactory$1.run(GtkPlatformFactory.java:28)
at com.sun.glass.ui.gtk.GtkPlatformFactory$1.run(GtkPlatformFactory.java:25)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.glass.ui.gtk.GtkPlatformFactory.<clinit>(GtkPlatformFactory.java:25)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:20)
at com.sun.glass.ui.Application.Run(Application.java:103)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:271)
... 5 more
Redhat is not listed as as supported configuration for JavaFX 2.2.
Nor is running JavaFX in a headless mode.
This may change for Java 8, but Java 8 has not been released yet, so the list of supported configurations for JavaFX running on Java 8 has not been published.
Currently the supported configuration set for Linux is only => Ubuntu 10.4+ gtk2 2.18+ with optional additional requirements for av codecs if you also want media playback support.
So try using a supported Ubuntu system instead of Redhat and you may or may not get that working in a headless environment.
I tested and it works fine with Redhat 6. Redhat 5 seems to be the problem.
Redhat Enterprise Linux 6 support will be added for Java 8 (to be released in the next few weeks).
A RHEL 5.5 support request was closed as won't fix, see RT-22564 "JavaFX Support for Red Hat Enterprise Linux 5.5".
If you can find a way to install gtk2 2.18+ on RHEL 5 you may be able to get it to work, though no promises.

Categories

Resources