I want to export my project to an runable jar file

a simple proeject just contain one class,

in eclise 3.4 ,it runs very well,but when i export it to an runnable jar file,

the jar file doesn't work



what's the reasons?

All libraries that are used by the project in eclipse (jars and native libs) need to be included with the game jar as well.

i wrote a tool yesterday to automate classpath generation…

here it is



http://www.noellynch.com/jme/cpMake.zip



just dump the jme_download_location/libs directory and jme_download_location/target (containing compiled jme jars) along with your apps jar into the resources directory of the tool and it will generate a dist directory with the relevant (i hope) batch and shell script files to run your app…

just replace the <YOUR_APP_HERE> entry with the main class name for your app…

it worked for me so i hope it works for you…

any problems just let me know…

I prefer using FatJar.  This descibes it, and other methods: http://www.jmonkeyengine.com/wiki/doku.php?id=packaging_and_deploying_jme_applications


Far Jar is an Eclipse plug-in that greatly simplifies deployment of Java programs by combining all of the necessary .jar files into a single .jar. This is useful as you no longer have to include a long classpath when running your program. Note that you will still have to include the native library location, as that cannot be packed into the .jar.

Fat Jar can also be combined with Launch4j or other Java wrappers to allow you to combine your entire program (except for native libraries) into a single compressed .exe. Note that when wrapping your application, you will need to include appropriate JVM arguments.

Example:

-Xmx1024m -Djava.library.path=./lib/


Fat Jar is available for download here: Fat Jar Plugin


To run it, you could make a .bat or executable BASH script that simply does something like

java -jar -Xmx1024m -Djava.library.path=./lib MyJar.jar

I always wondered if FatJar is available as a standalone application or, beter yet, Ant plugin, because I like to build from Ant. Last time I installed it, it didn't find such an option :(.