Slick Forums

Discuss the Slick 2D Library
It is currently Wed Oct 16, 2019 11:41 am

All times are UTC




Post new topic Reply to topic  [ 41 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Sat May 28, 2011 9:40 pm 
Offline

Joined: Sat May 28, 2011 9:32 pm
Posts: 4
Hi,
i've just started programing with Slick and already wrote some small arcade classics like Tetris, Pacman, etc.. So far i really love this library :).

Now i'd like to extract one of my Eclipse project into something executable like a .jar, .exe or .jnlp, but somehow i'm too stupid. The normal export to (runnable) jar feature from Eclipse never seems to work. Either he doesn't find the main class, the libraries or just does nothing at all, although the manifest should be correct...

Anyway, does anybody know a good and simple step by step guide to creating a .jar, .exe or .jnlp out of an Eclipse project?


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 28, 2011 10:05 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
you can if you like have a look at JarSplice, its a tool that'll create a executable jar for you (especially for slick and lwjgl projects).

1) Export your code and resources into a jar

2) simply start JarSplice and on the add jar tab, add your jar, also add lwjgl.jar, slick.jar and any other libraries that you are using.

3) on the native tab add all the native files that your are using *.dll files on windows, *.so for linux and *.jnilib, *.dylib for mac. Just add all the natives to it.

4) on the main class tab, add the main class of your project.

5) Create your executable jar. This will give you a single executable jar file to start your project from, no need to mess around with any native files after that as it'll all be self contained in that one jar.

Do let me know how it runs, since its the first revision of the tool.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 30, 2011 7:59 am 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
Could this executable jar also be used for Webstart or applets using your LWJGL AppletLoader stuff?

Do these executable jars also work on Mac and Linux or would I still need to provide some shell script?

Sounds very interesting :wink:

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 30, 2011 12:05 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
Tommy wrote:
Could this executable jar also be used for Webstart or applets using your LWJGL AppletLoader stuff?

It won't work with applets but it can be used with Webstart. I guess it would simplify things a little especially as you won't need separate native jars and only have to worry about one jar.

Tommy wrote:
Do these executable jars also work on Mac and Linux or would I still need to provide some shell script?

Yes, executable jars also work on mac and linux.

I am however thinking of adding an option later on that will spit out .exe, .sh and a mac bundle for each platform. However executables jars should be ok for now.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 04, 2011 2:22 pm 
Offline

Joined: Sat May 28, 2011 9:32 pm
Posts: 4
Hi,
sorry for not responding earlier. I totally forgot that i opened the thread :oops:.

JarSplice works perfectly and it's really easy to use. I hope JarSplice gets listed in the LWJGL General FAQ section "Distributing LWJGL Applications", since it's by far the easiest to use.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2011 10:47 pm 
Offline

Joined: Wed May 04, 2011 9:51 pm
Posts: 12
hi all, I'm trying to use the JarSplice for create a jar for windows, and I can't, I put the correct main class name, and all the jars I use (I put all slick jars and all the lwjgl jars, and of course, my jar file, I add the native files too, but it doesn't work... -.-


thanks in advance! :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2011 10:52 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
bonsai wrote:
hi all, I'm trying to use the JarSplice for create a jar for windows, and I can't, I put the correct main class name, and all the jars I use (I put all slick jars and all the lwjgl jars, and of course, my jar file, I add the native files too, but it doesn't work... -.-


thanks in advance! :)


Need more info on how it doesn't work? Can you run it on the command prompt and paste any output when you try to run the created jar? (type cmd in the run box, then run it as 'java -jar yourjar.jar').


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2011 10:55 pm 
Offline

Joined: Wed May 04, 2011 9:51 pm
Posts: 12
Thanks for the quick response! :)

I run this:

java -jar Zulema.jar

and I got this:

Invalid or corrupt jarfile Zulema.jar


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2011 11:01 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
hmm, the jar is being produced as corrupt, could be a bug, will look into it. possible you could upload the files your using to create the fat jar? (would make it easier to try to reproduce). Also if you run jarsplice.jar in the cmd, do you get any exceptions when creating the fat jar?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2011 11:13 pm 
Offline

Joined: Wed May 04, 2011 9:51 pm
Posts: 12
ok, sorry, I was doing many things wrong

1. the path to the mainClass (facepalm)
2. the .jars libraries (I was setting all from lwjgl and slick, but only needs slick.jar and lwjgl.jar)
3. the .dll libraries was wrong


basically ALL wrong xD

sorry, and thanks for response kappa ;) now the jar works perfectly :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2011 11:32 am 
Offline

Joined: Thu Jun 16, 2011 11:26 am
Posts: 7
ive got problems using jarsplice:

ive put
-jogg
-jorbis
-slick
-lwjgl
-slick in the jars tab

all the dll in the natives.

set to Jeu.Main.wizardGame as the main class
do i have to put src??

as it is in

-src
->package Jeu
-> package Main
-> class WizardGame

the error is : no classdeffound wizardGame
any thought?

and the manifest :

Manifest-Version: 1.0
Launcher-Main-Class: Jeu.Main.WizardGame.java
Main-Class: JarSpliceLauncher


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2011 11:42 am 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 585
The Jar Tab is missing your game jar. You don't include your source, instead you create your game jar by exporting your class files and resources (images, sounds, etc) from you IDE into a jar.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2011 11:46 am 
Offline

Joined: Thu Jun 16, 2011 11:26 am
Posts: 7
yep i figured it out for my game.jar
but now its almost launched but and error occurs

and this is due to Joog.jar i guess. if i put the Jogg , the jar is corrupted, if i dont put it, obvious no class deffound
any idea?


[/img]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2011 9:09 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1340
Location: Italy
to admins: can we please make this sticky topic? thanks!

_________________
Blog | Last game Drone Swarm


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2011 12:59 pm 
Offline

Joined: Wed Mar 16, 2011 12:48 pm
Posts: 1
I second that.

I've been looking for an easy way of making an exacutable .jar for some time, with varying luck. This tool is so simple, and works perfectly. This needs to be a sticky, and also be included in the Code samples, Tutorials and Help topic.

Great tool, thank you so much : D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 41 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group