LWJGL Forum

Programming => General Java Game Development => Topic started by: Spezi on August 23, 2006, 00:48:11

Title: start script for mac os x
Post by: Spezi on August 23, 2006, 00:48:11
Can anyone tell me how to build a start script for a java game for Mac OS X?

I just created a game.command file which contains just this one line:
java -Djava.library.path=lib/lwjgl/native/macosx:lib -Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true -jar game.jar


If I enter this in a console window the game runs as it should, but when launching (double clicking) this .command file I get this error:
Unable to access jarfile game.jar


I thought it would have something to do with paths, so I changed the line to this:
java -Djava.library.path=/Users/Spezi/Desktop/game/lib/lwjgl/native/macosx:/Users/Spezi/Desktop/game/lib -Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true -jar /Users/Spezi/Desktop/game/game.jar


This works, but how can this be run without setting absolute paths?

Or is there another (maybe better) way to easily run it?
Title: start script for mac os x
Post by: tortoise on August 24, 2006, 17:39:17
I'm at work right now and not near any Macs (unfortunately), but take a look at Eclipse.app and see how they do it. They set it up quite well to run as a "native" app.

You should be able to right click on Eclipse.app and select something like "open package contents" to see what's inside (foo.app is really a folder that the OS presents as a single entity).

In there should be info.plist and a few other things that allow a Java app to be launched just like a native one.
Title: start script for mac os x
Post by: Spezi on August 25, 2006, 01:44:08
Thanks for the idea with the .app.

After hours of trying to build it on my own I googled a bit and found out about a programm called 'Jar Bundler' which made creating the structure an easy step.

So I got it double clickable running now, although some tiny hidden parameter to the command line would had also satisfied me. :P