简体   繁体   中英

Possible to write command properties in a file

I need to run a Java programme with JMX feature, so the command would be similar like :

java -Dcom.sun.management.jmxremote.port=10200 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.password.file=jmxremote.password -Dcom.sun.management.jmxremote.access.file=jmxremote.access

this makes the command line too long, is it possible to write the properties in a file, in order to shorten the command? Or any other solutions will be welcome!

You can use property file (management.properties) which contains all the JMX options as shown below.

com.sun.management.jmxremote.port=10200
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false
....

But you have to tell where the JMX properties are available for the JVM by

java -Dcom.sun.management.config.file=c:\\management.properties

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