Hello Guest

start script for mac os x

  • 2 Replies
  • 5561 Views
*

Offline Spezi

  • *
  • 43
start script for mac os x
« 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:
Code: [Select]
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:
Code: [Select]
Unable to access jarfile game.jar


I thought it would have something to do with paths, so I changed the line to this:
Code: [Select]
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?

start script for mac os x
« Reply #1 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.

*

Offline Spezi

  • *
  • 43
start script for mac os x
« Reply #2 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