LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: mhatzitaskos on October 23, 2005, 11:18:16

Title: jar a project and native files
Post by: mhatzitaskos on October 23, 2005, 11:18:16
hi, i created a game with java and lwjgl.

I used -Djava.library.path when I compiled and run the game when I was
developing it, but now I want to compile everything into a jar file.
However, when I do that java doesnt find the native files.

My project has the following folders:
/classes/  my classes and the main class
/native/  the native lwjgl files
/sounds/  sounds of the game
/images/ images of the game
/libs/   libraries, such as the lwjgl

In the manifest of the jar i can specify the classpath but not the
library.path....
Even if I leave the /native/ and /libs/ folders outside the .jar file,
it still doesnt work. Can you please help me?

I cant have people running my game through command prompt :(
i want excecutable jars.

Please help,
regards,
Markos
Title: jar a project and native files
Post by: Optus on October 24, 2005, 23:33:02
Avoid command prompt, batch files and executable jars.  Executable Jars depend upon Windows' built-in registry setting to decide what will open them.  Since .JAR is actually just a zip file, some archiving programs will assume control of that file association.  Thus, in some cases, your game can't be run just by executing the jar.  I would check out JSmooth http://jsmooth.sourceforge.net.  It can create regular old executables (.exe) that can automatically detect any JREs on the computer, and run your game. All without setting a java_home variable, command lines, nasty batch files or anything like that.  If they don't have a suitable version of Java, it will redirect them to a website to download it.  You can even tell JSmooth to bundle the JVM with your game, and never worry about the user needing to install Java ever again.
Title: hmmmmm...
Post by: Fool Running on October 25, 2005, 13:15:50
Wow! :shock: I didn't know something like that existed.  I can ditch my batch files now.  :lol:
Thank you!
Title: jar a project and native files
Post by: elias4444 on October 27, 2005, 14:42:54
I'd also have to recommend launch4j (launch4j.sf.net). I've used both that and JSmooth, and although JSmooth is easier, launch4j has a much broader range of options and has also been actively developed.