Equivalent of double-clickable .sh and .bat on Mac?

后端 未结 4 1465
无人共我
无人共我 2021-01-31 18:49

I am distributing a Java program where I want a double-clickable file to run

java -cp MyProgram.jar;MyLib.jar my.program.Main

On Windows I simp

相关标签:
4条回答
  • 2021-01-31 18:56

    For Java applications on Mac, you really should use Apple's Jar Bundler (in the Developer Tools/Applications/Utilities folder; really a symlink to /usr/share/java/Tools/Jar Bundler). It lets you make a proper OS X double-clickable app, including setting preferences for e.g. using the Mac toolbar, JVM version, graphics system, OS X app metadata and classpath/resources.

    0 讨论(0)
  • 2021-01-31 19:02

    You can use a .sh (Shell Script), after all MacOSX is Unix!

    0 讨论(0)
  • 2021-01-31 19:04

    On mac, there is a specific extension for executing shell scripts by double clicking them: this is .command.

    0 讨论(0)
  • 2021-01-31 19:05

    The answer about using the Jar Bundler tool is correct, but if you want to use a .sh file, make sure the unix permissions are set properly to something like 755 with CHMOD, and make sure the first line contains the path to a shell installed by default on Mac OS X. Also note that even with the +x bit set, it may still ask the user whether they want to open it or run it.

    0 讨论(0)
提交回复
热议问题