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 scri开发者_如何学JAVApt before java application starts. How can i do it?
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.
精彩评论