hexware
hexware

Reputation: 63

How to make sh script the application for Mac OS

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?

Upvotes: 1

Views: 1894

Answers (1)

echo
echo

Reputation: 7875

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.

Upvotes: 2

Related Questions