简体   繁体   中英

Add arguments to runnable jar file Mac OS

I have created little java program with SWT. For run it on Mac I need to use argument XstartOnFirstThread. So from terminal I can start it like

java -XstartOnFirstThread -jar progname.jar

Can I open this program using double click with this parameter? I know I may create script to run it, but is this possible without script?

There is a related question here .

The answer posted by Peter Lawrey states it outright: There is no way to pass the argument when starting the .jar by double-clicking.

However, there are alternatives:

  1. The double click starts a wrapper program which then starts your program with the parameter (as suggested in the linked answer).
  2. Create a script file that launches your application.
  3. Create a proper OSX application instead .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM