Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (788)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (862)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED] Can't Launch Game jar  (Read 2724 times)
0 Members and 1 Guest are viewing this topic.
Offline duce

Senior Newbie

« Posted 2011-11-24 19:44:54 »

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.
Offline Alan_W

JGO Knight

Medals: 8
Projects: 3

Java tames rock!

« Reply #1 - Posted 2011-11-24 20:01:58 »

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
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.

Time flies like a bird. Fruit flies like a banana.
Offline Saucer

Junior Devvie

Medals: 1

« Reply #2 - Posted 2011-11-24 21:36:17 »

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.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gbeebe

Senior Devvie

Medals: 5
Projects: 1

« Reply #3 - Posted 2011-11-24 23:01:12 »

What does your java console say?
Offline duce

Senior Newbie

« Reply #4 - Posted 2011-11-25 00:17:29 »

Thanks for all the help! I used JarSplice ( to put lwjgl's natives in the right place.
Offline ra4king

JGO Kernel

Medals: 508
Projects: 3
Exp: 5 years

I'm the King!

« Reply #5 - Posted 2011-11-25 03:06:49 »

You have 2 options:
- If you want to launch directly by double-clicking the jar file, you will have to put all the natives and other JARs in the same directory as the game JAR and modify the Class-Path in the Manifest to include the other JARs, as Alan_W has showed you.
- Otherwise if you want to organize your natives and JARs, you will have to use a script (a BAT file for Windows or shell script for Unix) that looks like this:
java -Djava.library.path="relative/path/to/natives/folder/" -cp "relative/path.jar;to/jars.jar" -jar MyGame.jar

Offline Cero
« Reply #6 - Posted 2011-11-25 03:22:34 »

JarSplice never worked for me either and the eclipse export jar thing always worked nicely, so haven't bothered with JarSplice anymore since then

Pages: [1]
  ignore  |  Print  

hadezbladez (2166 views)
2018-11-16 13:46:03

hadezbladez (818 views)
2018-11-16 13:41:33

hadezbladez (2138 views)
2018-11-16 13:35:35

hadezbladez (421 views)
2018-11-16 13:32:03

EgonOlsen (3459 views)
2018-06-10 19:43:48

EgonOlsen (3687 views)
2018-06-10 19:43:44

EgonOlsen (2276 views)
2018-06-10 19:43:20

DesertCoockie (3005 views)
2018-05-13 18:23:11

nelsongames (3085 views)
2018-04-24 18:15:36

nelsongames (3903 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!