Unable to install CPUSim in Ubuntu - java

I need to run CPUSim Version 4 for a project in my university. Upon following the directions given by the website and the README.md , I receive this error:
java -cp .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar -jar CPUSim-4.0.11.jar
This gave me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at cpusim.Main.main(Main.java:73)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 10 more
I've browsed forums and tried to install openjfx but it didn't work.
I tried to download the JavaFX runtime and run it using this command:
java --module-path $JFX --add-modules javafx.controls -cp .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar -jar CPUSim-4.0.11.jar
which resulted in this:
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:834)
Caused by: java.lang.NoClassDefFoundError: javafx/fxml/Initializable
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at cpusim.GUIMain.start(GUIMain.java:50)
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.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
... 1 more
Caused by: java.lang.ClassNotFoundException: javafx.fxml.Initializable
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 19 more
Now I'm clueless as to what to do, I'm just trying to get this to run. None of this makes sense to me at the moment. Any help will be appreciated.
my java version:
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

Here:
Caused by: java.lang.ClassNotFoundException: javafx.fxml.Initializable
Basically tells you: the javax stuff is missing.
Thing is: getting javafx to work on some Linux distribution is actually tricky, as there are so many different ways the distributions/JDK packages "deliver" JavaFX.
I suggest you turn to here to find out what exactly your environment needs.

It appears from the stack trace that you are using FXML for your application. The javafx.fxml package is in a separate module (with the same name as the package) to the controls, so you also need to include that on the command line:
java --module-path $JFX --add-modules javafx.controls,javafx.fxml -cp .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar -jar CPUSim-4.0.11.jar

Related

How to build maven project on Raspberry pi

I have a JavaFx maven project which I develop on a Windows 10 machine but later will use on a Raspberry pi 4 with the latest raspbian os. I had developed now until a specific state of my application and wanted to test it on my pi now. I have the latest liberica Jdk 15 installed on my pi but I am getting an error which I dont understand:
**OpenJDK Server VM warning: You have loaded library /home/pi/.openjfx/cache/15/libprism_es2.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /home/pi/.openjfx/cache/15/libprism_es2.so: /home/pi/.openjfx/cache/15/libprism_es2.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: can't load AMD 64 .so on a ARM platform)
java.lang.UnsatisfiedLinkError: /home/pi/.openjfx/cache/15/libprism_es2.so: /home/pi/.openjfx/cache/15/libprism_es2.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: can't load AMD 64 .so on a ARM platform)**
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2407)
at java.base/java.lang.Runtime.load0(Runtime.java:747)
at java.base/java.lang.System.load(System.java:1857)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
at javafx.graphics/com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:69)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at javafx.graphics/com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:51)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:377)
at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:832)
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: /home/pi/.openjfx/cache/15/libprism_sw.so: /home/pi/.openjfx/cache/15/libprism_sw.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: can't load AMD 64 .so on a ARM platform)
java.lang.UnsatisfiedLinkError: /home/pi/.openjfx/cache/15/libprism_sw.so: /home/pi/.openjfx/cache/15/libprism_sw.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: can't load AMD 64 .so on a ARM platform)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2407)
at java.base/java.lang.Runtime.load0(Runtime.java:747)
at java.base/java.lang.System.load(System.java:1857)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
at javafx.graphics/com.sun.prism.sw.SWPipeline.lambda$static$0(SWPipeline.java:42)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at javafx.graphics/com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:377)
at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:832)
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:244)
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:261)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
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:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:832)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: No toolkit found
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:273)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
... 5 more
And another thing is even though I installed liberica and set it in my project if I run java --version I am getting this print:
openjdk 15 2020-09-15
OpenJDK Runtime Environment (build 15+36)
OpenJDK Server VM (build 15+36, mixed mode)
Can someone maybe tell me wht my mistake is?
How did you build the .jar ?
Some tools, for example the shade plugin don't create a cross platform jar.
This would explain the exception: can't load AMD 64 .so on a ARM platform
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: /home/pi/.openjfx/cache/15/libprism_sw.so: /home/pi/.openjfx/cache/15/libprism_sw.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: can't load AMD 64 .so on a ARM platform)
java.lang.UnsatisfiedLinkError: /home/pi/.openjfx/cache/15/libprism_sw.so: /home/pi/.openjfx/cache/15/libprism_sw.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: can't load AMD 64 .so on a ARM platform)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)

Pentaho - Error working with XUL definition

I'm running into an issue with Pentaho Community Edition on mac running Catalina. When I go to either create a new database connection or edit an existing one, I get an error message saying Error working with XUL definition and org.pentaho.ui.xul.XulException: java.lang.reflect.InvocationTargetException.
Error details are as follows:
at org.pentaho.ui.xul.impl.AbstractXulLoader.loadXul(AbstractXulLoader.java:134)
at org.pentaho.ui.xul.swt.SwtXulLoader.loadXul(SwtXulLoader.java:128)
at org.pentaho.ui.xul.swt.SwtXulLoader.loadXul(SwtXulLoader.java:122)
at org.pentaho.ui.xul.impl.AbstractXulLoader.loadXul(AbstractXulLoader.java:242)
at org.pentaho.ui.database.DatabaseConnectionDialog.getSwtInstance(DatabaseConnectionDialog.java:60)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.createDialog(XulDatabaseDialog.java:153)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:107)
at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:60)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:494)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:481)
at org.pentaho.di.ui.spoon.Spoon.newConnection(Spoon.java:8750)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141)
at org.pentaho.ui.xul.jface.tags.JfaceMenuitem.access$100(JfaceMenuitem.java:43)
at org.pentaho.ui.xul.jface.tags.JfaceMenuitem$1.run(JfaceMenuitem.java:106)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4385)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3789)
at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1366)
at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7984)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9245)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:692)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)
Caused by: org.pentaho.ui.xul.XulException: java.lang.reflect.InvocationTargetException
at org.pentaho.ui.xul.impl.XulParser.getElement(XulParser.java:239)
at org.pentaho.ui.xul.impl.XulParser.parse(XulParser.java:164)
at org.pentaho.ui.xul.impl.XulParser.parse(XulParser.java:171)
at org.pentaho.ui.xul.impl.XulParser.parse(XulParser.java:171)
at org.pentaho.ui.xul.impl.XulParser.parse(XulParser.java:171)
at org.pentaho.ui.xul.impl.XulParser.parseDocument(XulParser.java:85)
at org.pentaho.ui.xul.impl.AbstractXulLoader.loadXul(AbstractXulLoader.java:126)
... 40 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.pentaho.ui.xul.impl.XulParser.getElement(XulParser.java:227)
... 46 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/swt/custom/TableTreeItem
at org.eclipse.jface.util.OpenStrategy.initializeHandler(OpenStrategy.java:269)
at org.eclipse.jface.util.OpenStrategy.<init>(OpenStrategy.java:107)
at org.eclipse.jface.viewers.StructuredViewer.hookControl(StructuredViewer.java:1161)
at org.eclipse.jface.viewers.ListViewer.<init>(ListViewer.java:79)
at org.eclipse.jface.viewers.ListViewer.<init>(ListViewer.java:67)
at org.pentaho.ui.xul.swt.tags.SwtListbox.<init>(SwtListbox.java:90)
... 51 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.custom.TableTreeItem
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 57 more
I'm running Java 8, and I've replaced the swt.jar file with the most recent version. Any idea what other steps I could take to alleviate the issue?
I ran into this same problem and it turned out to be an issue with the latest version of Java 8 (u291). I downgraded to jdk-8u202 and used the default swt.jar file that comes with pdi-ce-9.1.0.0-324.
Uninstall current version of Java:
In the Terminal window Copy and Paste the commands below:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Oracle/Java
Download and install older version:
https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
Don't forget to swap out the swt.jar file inside /Applications/data-integration/libswt/osx64
You may need to redownload the original data-integration folder to get the correct swt.jar file (that's what I did).

Exception during createing exe file

Im trying to convert my runnable jar into .exe file but i get this Exception in Launch4j program:
Executing: C:\Users\szymo\Desktop\SwordAndOgrs.exe
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:515)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:423)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:417)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:416)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:416)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:59)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
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)
... 13 more
While im running code from Eclipse it works perfect. I already add javaFx SDK to buildPath.

IllegalAccessError when creating a MediaView

I try to implement a MediaView into an existing UI created in JavaFX. All my other code works fine with different Panes, Labels, ImageViews and Buttons. When I try to add the MediaView I get:
Caused by: java.lang.IllegalAccessError: superclass access check failed: class javafx.scene.media.NGMediaView (in unnamed module #0x6f0df6bf) cannot access class com.sun.javafx.sg.prism.NGNode (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.sg.prism to unnamed module #0x6f0df6bf
I tried switching jdk&jfx to latest version(13) which didn't help.
I tried adding the modules with --add-module in different versions which didn't work either.
Pane p= (Pane) scene1.lookup("#media_pane");
MediaView mv=new MediaView();
mv.setFitWidth(300);
mv.setFitHeight(300);
p.getChildren().add(mv);
"C:\Program Files\Java\jdk-13\bin\java.exe" --module-path "C:/Program Files/Java/javafx-sdk-13/lib" --add-modules javafx.controls,javafx.fxml,javafx.graphics --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED -Djava.library.path=C:\Germaneers\JavaWorkspace\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App\lib "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2\lib\idea_rt.jar=58845:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Germaneers\JavaWorkspace\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App\out\production\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App;C:\Program Files\Java\javafx-sdk-13\lib\javafx-swt.jar;C:\Program Files\Java\javafx-sdk-13\lib\javafx.base.jar;C:\Program Files\Java\javafx-sdk-13\lib\javafx.controls.jar;C:\Program Files\Java\javafx-sdk-13\lib\javafx.fxml.jar;C:\Program Files\Java\javafx-sdk-13\lib\javafx.graphics.jar;C:\Program Files\Java\javafx-sdk-13\lib\javafx.media.jar;C:\Program Files\Java\javafx-sdk-13\lib\javafx.swing.jar;C:\Program Files\Java\javafx-sdk-13\lib\javafx.web.jar;C:\Germaneers\JavaWorkspace\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App\lib\kotlin-stdlib.jar;C:\Germaneers\JavaWorkspace\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App\lib\kotlin-reflect.jar;C:\Germaneers\JavaWorkspace\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App\lib\kotlin-test.jar;C:\Germaneers\JavaWorkspace\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App\lib\kotlin-stdlib-jdk7.jar;C:\Germaneers\JavaWorkspace\19-AU-EE74-001-Kombianzeige-im-Schwarzdruck-App\lib\kotlin-stdlib-jdk8.jar" main.Main
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:567)
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:567)
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:830)
Caused by: java.lang.IllegalAccessError: superclass access check failed: class javafx.scene.media.NGMediaView (in unnamed module #0x6f0df6bf) cannot access class com.sun.javafx.sg.prism.NGNode (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.sg.prism to unnamed module #0x6f0df6bf
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:823)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:721)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:644)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at main.Main.initScene1(Main.java:62)
at main.Main.start(Main.java:36)
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(AccessController.java:391)
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 main.Main
Process finished with exit code 1

App runs with --add-modules=java.se.ee in Eclipse but not on command line

I'm using Java 9-ea to both run an app built in Eclipse and to run a Ant-built jar of the same app on the commend line. In Eclipse everything works if I pass the --permit-illegal-access --add-modules=java.se.ee VM args but if I pass the same on the command line:
java --add-modules=java.se.ee --permit-illegal-access -jar swing/build/jar/OpenRocket.jar
things fail at runtime:
java.lang.RuntimeException: Error starting OpenRocket
at net.sf.openrocket.startup.jij.JarInJarStarter.runMain(JarInJarStarter.java:40)
at net.sf.openrocket.startup.OpenRocket.main(OpenRocket.java:36)
Caused by: 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:563)
at net.sf.openrocket.startup.jij.JarInJarStarter.runMain(JarInJarStarter.java:38)
... 1 more
Caused by: java.lang.reflect.InvocationTargetException
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1323)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1298)
at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1475)
at net.sf.openrocket.startup.SwingStartup.main(SwingStartup.java:76)
... 6 more
Caused by: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: javax/script/ScriptEngineFactory
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4992)
at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:138)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:550)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:887)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:808)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:285)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:217)
at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:893)
at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46)
at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:134)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
at com.google.inject.Guice.createInjector(Guice.java:99)
at com.google.inject.Guice.createInjector(Guice.java:73)
at com.google.inject.Guice.createInjector(Guice.java:62)
at net.sf.openrocket.startup.SwingStartup.runInEDT(SwingStartup.java:143)
at net.sf.openrocket.startup.SwingStartup.access$000(SwingStartup.java:43)
at net.sf.openrocket.startup.SwingStartup$1.run(SwingStartup.java:79)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:759)
at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:712)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:706)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:88)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:729)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: javax/script/ScriptEngineFactory
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4992)
at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
at com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:68)
at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:75)
at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
at com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
... 37 more
Caused by: java.lang.NoClassDefFoundError: javax/script/ScriptEngineFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3134)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2285)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:688)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:380)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165)
at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:616)
at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:572)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:558)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:887)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:808)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:285)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:217)
at com.google.inject.internal.SingleFieldInjector.<init>(SingleFieldInjector.java:42)
at com.google.inject.internal.MembersInjectorStore.getInjectors(MembersInjectorStore.java:131)
at com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:98)
at com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:37)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:45)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:42)
at com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
... 52 more
Caused by: java.lang.ClassNotFoundException: javax.script.ScriptEngineFactory
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:553)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:486)
... 76 more
The failure comes down to
java.lang.NoClassDefFoundError: javax/script/ScriptEngineFactory
but --add-modules=java.se.ee is supposed to expose that class so it can be found (and that seemingly works in Eclipse).
What could be wrong?
The problem seems specific to my app. I noticed that it does shady things at startup: https://github.com/openrocket/openrocket/blob/master/swing/src/net/sf/openrocket/startup/jij/JarInJarStarter.java

Categories

Resources