Executable Jar not working: JNI error

已回答

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?

0

Hi there,

First, make sure that java -version and javac -version are 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-INF directory in the /main/resources folder instead of main/java.

1

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?

0

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?

 

0

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.

0

请先登录再写评论。