Executable Jar not working: JNI error
Answered
I followed the instructions on how to create an executable jar from this video which agrees with multiple other explanations:
https://www.youtube.com/watch?v=_XQjs1xGtaU
But my Executable Jar returns the following error when it is ran:

My code runs in the IDE it has a GUI, uses an external library, and accesses an API:


What can I do to fix this?
Please sign in to leave a comment.
Hi there,
First, make sure that
java -versionandjavac -versionare the same. If they are not, you need to manage your Java installations and environment variables in the system.Then try creating a new artifact, only this time select the "Copy to the output directory..." option (see also https://stackoverflow.com/a/43855741)
In case of other problems, try putting the
META-INFdirectory in the/main/resourcesfolder instead ofmain/java.My project structure does not contain a main folder.
also this is what happened when I tried to check the javac version:
Where do I go from here?
Ok, so I was able to install Java SE 17 and created a working executable Jar. The only issue I have now, is that the application no longer has the icon image that I had working in my code using intelliJ. Is there a way to fix this?
Try right-clicking on the image in the Project view > Copy Path/Reference... > Path from content root, then paste the string into the method's parameter and rebuild the project.