简体   繁体   English

可以在文件中写入命令属性

[英]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 :我需要运行具有 JMX 功能的 Java 程序,因此命令类似于:

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 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.您可以使用包含所有 JMX 选项的属性文件 (management.properties),如下所示。

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但是您必须通过以下方式告诉 JVM 可使用 JMX 属性的位置

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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