This site requires JavaScript, please enable it in your browser!
Greenfoot back
Reubenthekiwi
Reubenthekiwi wrote ...

2020/12/19

JNI Error

Reubenthekiwi Reubenthekiwi

2020/12/19

#
Hi, I'm new to Greenfoot here. I know Java quite well and often make my own Java program and applications. But lately, I have encountered an annoying error. When I run the .jar file from File Explorer or the Command Prompt, it always shows me a dialog message saying "JNI Error" and I tried to fix it but nothing works. Maybe some of you can help me? The error when trying to run it from Command Prompt: Error: Could not find or load main class greenfoot.export.GreenfootScenarioApplication Caused by: java.lang.NoClassDefFoundError: javafx/application/Application And the ol' JNI Error: Error: A JNI error has occurred, please check your installation and try again. A Java exception has occurred. Oh, and also.. Exception in Application start method 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: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.NullPointerException at greenfoot.core.ExportedProjectProperties.load(ExportedProjectProperties.java:63) at greenfoot.core.ExportedProjectProperties.<init>(ExportedProjectProperties.java:52) at greenfoot.export.GreenfootScenarioViewer.<init>(GreenfootScenarioViewer.java:138) at greenfoot.export.GreenfootScenarioApplication.start(GreenfootScenarioApplication.java:39) 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
19598 19598

2020/12/21

#
Why would you need to run your .jar file from the command prompt or file explorer?
PaulRosca PaulRosca

2020/12/22

#
Are you running the .jar with the command provided by Greenfoot when exporting the scenario? It wont' work otherwise.
You need to login to post a reply.