Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 1379 times)
0 Members and 1 Guest are viewing this topic.
Offline duce

Senior Newbie





« Posted 2011-11-24 20: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 21: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:

1  
2  
3  
4  
5  
6  
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.

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

Junior Member


Medals: 1



« Reply #2 - Posted 2011-11-24 22: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 Member


Medals: 5
Projects: 1



« Reply #3 - Posted 2011-11-25 00:01:12 »

What does your java console say?
Offline duce

Senior Newbie





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

Thanks for all the help! I used JarSplice (http://ninjacave.com/jarsplice) to put lwjgl's natives in the right place.
Offline ra4king

JGO Kernel


Medals: 337
Projects: 2
Exp: 5 years


I'm the King!


« Reply #5 - Posted 2011-11-25 04: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:
1  
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 04: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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!