[Solved] Export a (libgdx) project to jar file with Eclipse

Whenever I try export my game (which works fine in Eclipse) to a runnable JAR file, it will not create a runnable JAR file, just a folder containing the projects data. Any ideas what I’m doing wrong?

I have tried following methods in Eclipse:

File->Export->Runnable JAR file->Extract required libaries into generated JAR.
File->Export->Runnable JAR file->Package required libaries into generated JAR.

with launch configuration:
DesktopLauncher - “game”-dektop.

But I just can’t get it as a runnable JAR file.

The way I do it is sort of incorrect I was told, so I’ll tell you another good method. Putting everything in a zip file. Have your resource folder in there too. I think you just export as a runnable jar, then use jarSplice to put in your libraries. once you create the fat jar, then you put it in the zip folder. I’m not 100% sure this works the same for libGDX.

Also, if you’re having trouble running the jar, try starting it with cmd. In cmd input

cd desktop

press enter

java -jar ThenameOfyourProject.jar

It should tell you any errors it finds.

Silly question but do you add the .jar to the file name where it asks where to save the file?

Thanks, the JarSplice made it work with a breeze!

You should try: Right Click Desktop project -> Export -> Pack required libraries into jar file.

Maybe eclipse does different things when doing File -> Export and Project -> Export, since the latter works for me.

Am I allowed to re-open this?

Looks like you were successful. What’s the latest on this topic? I know Eclipse has gone through a lot of changes since the last post here.