简体   繁体   中英

How to pass options to a jar file using Netbeans

I need to be able to pass option flags to Java when my users execute a given Jar file. I am using Netbeans as my IDE and it would be nice if I could set it somewhere inside there to avoid manually changing each jar file to do this.

I know under the project if you right click, go properties, then run, you can set options there but I don't believe it builds it into the distributable jar file.

Please note I am NOT asking how to read parameters passed to the jar program itself, I need to pass options to Java.

fd is correct. The options read out of a jar and applied to the JVM being launched are pretty minimal... but there may be another way to approach this.

You can use the javaws command to read a JNLP file that will create a JVM that is much more customized. If your users will have access to a common site, you can probably just distribute the jnlp file and let javaws handle accessing the jar file for your app. If users will not have access to a common server, you will want to distribute both files (jnlp and jar) and let them install them together.

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