tags:

views:

128

answers:

5

I have a short script to start my application (it invokes java with some parameters). The application needs a grannny-proof launcher for Mac OS X. The application is not installed, it is not even copied to the host disk, it is instead delivered on USB sticks.

When the user inserts the stick and opens it up, she should be able to click an appropriately named file (start_osx.sh for instance would do) and this would execute the script inside.

I'm failing at this right now. When I click said file, it opens up in the text editor. Even if chmod +x is set on the file.

Compiling the script to a "native" executable is an option if that will help me.

Bonus points for if I can customize the file's icon as displayed in the file browser.

+2  A: 

You need to create an application bundle. You'll get an icon, etc.

This seems to be a useful guide for Java, but I haven't bothered with Java for a while:

http://developer.apple.com/documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html

More general:

http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html#//apple_ref/doc/uid/10000123i-CH1-SW1

janm
+1  A: 

Mac OS X launches application bundles (folder with a given structure). You can wrap your shell script inside an application bundle by using platypus.

The application icon is part of the application bundle content.

diciu
A: 

Add .command to the filename (i.e. start_osx.sh.command)

This will execute, but with the working directory as the user's home folder.

Add

cd "`dirname "$0"`"

To the script and the working directory will be the directory the script was launched from.

frou
A: 

alternatively, you can create an applescript that runs the application...

Brian Postow