开发者

How to make sh script the application for Mac OS

开发者 https://www.devze.com 2022-12-17 19:32 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消