Reading Java system properties from command line

后端 未结 3 2024
执笔经年
执笔经年 2021-01-30 01:05

Is there a better way to print system properties from command line? As we can set the property e.g.

 java  -D=  //set a system property         


        
3条回答
  •  无人及你
    2021-01-30 01:24

    If you need defaults that your JVM will initially have set unless overridden, use:

    java -XshowSettings:properties -version  
    

    This is helpful if you don't have a Java application already running, thus no pid to pass to one of the other commands.

    If you are seeking the properties of a JVM already running that has properties set via default or set explicitly by command, then use the pid for that JVM found via jps with the jcmd or jinfo commands as listed in answers above.

提交回复
热议问题