I exported my jar in eclipse, but it won’t run. There are no errors, nothing happens. I tried putting the req. libraries in a folder and tried packaging them in a jar, but it still does nothing.
Edit: I’m using the Slick2D framework.
I exported my jar in eclipse, but it won’t run. There are no errors, nothing happens. I tried putting the req. libraries in a folder and tried packaging them in a jar, but it still does nothing.
Edit: I’m using the Slick2D framework.
Open the jar with Winzip or 7-zip.
Check there is a folder called META-INF that contains a file called MANIFEST.MF
Open MANIFEST.MF in a text editor.
It should be something like:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.3-b01 (Sun Microsystems Inc.)
Main-Class: LevelEditor.LevelEditor
Class-Path:
X-COMMENT: Main-Class will be added automatically by build
Look for the line Main-Class which should list the class file in the jar which contains the main() function that is to be called.
If any of the above isn’t there, you haven’t got an executable jar.
Edit: If that isn’t it, I’d look at the Class-Path next, which probably should have something in it if you are using additional libraries.
I don’t really know how all of this works, but what works for me is putting the relevant DLLs and JAR libraries in the same folder as the exported JAR.
What does your java console say?
Thanks for all the help! I used JarSplice (http://ninjacave.com/jarsplice) to put lwjgl’s natives in the right place.
You have 2 options:
java -Djava.library.path="relative/path/to/natives/folder/" -cp "relative/path.jar;to/jars.jar" -jar MyGame.jar
JarSplice never worked for me either and the eclipse export jar thing always worked nicely, so haven’t bothered with JarSplice anymore since then