1

Short issue

I've been porting a JavaFX application to java 11. And after many hurdles I ran across the issue of : When I start the jar by double clicking it , it returns a JNI error. But when running it through console it works. How can I make it work when double clicked


Prerequisites

After looking up this issue on google , the results I found are summed up in A JNI error has occurred, please check your installation and try again in Eclipse x86 Windows 8.1

It recommends checking the java and javac versions, if they do not return the same java version then reinstall java on the pc.

PS C:\Users\nolookielookie> java -version
 openjdk version "11" 2018-09-25
 OpenJDK Runtime Environment 18.9 (build 11+28)
 OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

PS C:\Users\nolookielookie> javac -version
 javac 11

They return the same version.

Also you can see the installed java version here, keep in mind i also have java 8 installed to support some legacy business applications.


More explanation of the issue

When double-clicking the java app (windows 10) it gives this popup. popup that appears

But when running the application through the command prompt. it works IT JUST WORKS FROM THE COMMAND PROMPT.

Screenshots : https://i.stack.imgur.com/wmtAB.jpg

Luka K.
  • 55
  • 8
  • Are you sure that the JAR file extension is registered to the Java11 runtime? – Robert Nov 13 '20 at 18:45
  • Yes, i tried uninstalling java and installing it again. – Luka K. Nov 13 '20 at 21:44
  • Uninstalling and reinstalling does not necessarily indicates which java version is used. Uninstall it again and try to execute the jar file again. If it still shows the same error message you have somewhere another Java version installed. After reinstalling Java also check what happens if you execute `javaw -jar your.jar` this is the command that should be used when doubleclicking a jar in the Explorer. – Robert Nov 13 '20 at 23:04
  • It says that it can not access the jar `ERROR : Unable to access jarfile example.jar` – Luka K. Nov 14 '20 at 00:22

0 Answers0