开发者

How to make a shell script run in Mac when double clicking it?

开发者 https://www.devze.com 2023-01-22 04:51 出处:网络
I have created a shell script to run a jar file in Mac : #!/bin/sh java -Xmx512m -jar test.jar; I have renamed this script \"app.command\" to run directly when double clicking it. And i have applie

I have created a shell script to run a jar file in Mac :

#!/bin/sh
java -Xmx512m -jar test.jar;

I have renamed this script "app.command" to run directly when double clicking it. And i have applied "chmod +x" command to it to 开发者_开发知识库have executable permissions.

Now when double clicking this script, i get "Unable to access jarfile test.jar" while when running this script through Terminal, the jar runs fine !

Anyone can help me how to make this script run when double click it in Mac ?


If you run from a terminal, you have a working directory set, and this may not be the case if you double-click it. Try giving the full path to the jarfile in your script.

0

精彩评论

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