views:

58

answers:

1

I wrote java application and i need to make it standalone for macos(.app). Earlier I used jar builder, but now i need to execute some shell script before java application starts. How can i do it?

+1  A: 

If you want a double-clickable application, you could use AppleScript to execute the shell script and then the application. The AppleScript Editor allows you to save a script as a .app application. Simplest thing that would work:

tell application "Terminal"
    do script with command "cd /Users/justin/Desktop; ./app.sh; java myApp"
end tell

File -> Save As, and choose "Application" under File Format.

EDIT: Even simpler, you could execute the shell script from within the java app... Depends on what you're trying to accomplish though.

echo