Run Jar

Is it possible to run the jar created by JMP in the dist directory?

I tried using the command from here: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:simpleapplication_from_the_commandline

with and without the classpath and i get java.util.zip.ZipException

I think it is thrown when it tries to extract the native libraries

The application runs ok in the JMP and netbeans

Just use “java -jar MyGame.jar” or double-click the jar file.

The classpath is stored in the manifest of the jar file and as long as there is the “lib” folder next to the jar it will work.

Cheers,

Normen



Edit: Oh, the zipexception probably means you are loading a zip file like town.zip? Then you have to copy that file to the dist folder as well.

Thx for your reply.

I didn’t use .jar in the end.

Is there a way to combine the lib folder I have, in my dist folder, with the jar to create a user-friendly SINGLE executable file (jar or exe doesn’t matter)?

I dont exactly know if a hundred MB executable file is very user-firendly… But you could unpack all jars and then pack them all up in one jar, yes… Read about the ANT build system, the jME project is based on an ANT script.

Still, I dont think you would want to do that. If for example newer versions of windows become incompatible with lwjgl you’d have to replace the whole game while when the jars are separate you can just tell your users to download a new version and throw it in the lib directory.

Cheers,

Normen