Reading Java system properties from command line

后端 未结 3 2020
执笔经年
执笔经年 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:26

    You can use jps a tool that comes with the jdk. It can print out the system properties that were passed to a java process.

    For example: On my system eclipse is running and

    $ jps -v
    

    outputs

    6632  -Dosgi.requiredJavaVersion=1.6 -Xms1024m -Xmx2048m -XX:MaxPermSize=512m
    

    jps is located in JDK_HOME/bin

    EDIT

    If you want all the properties use the jinfo tool that is also located in JDK_HOME/bin. To use it you must know the process id of the java process you want to get information from. E.g.

    $ jinfo 6632
    

    This tool also prints out the java.ext.dirs

提交回复
热议问题