JVM配置

1
假设你是windows平台,你安装了J2SDK,那么现在你从cmd控制台窗口进入J2SDK安装目录下的bin目录,然后运行java命令,出现如下结果,这些就是包括java.exe工具的和JVM的所有命令都在里面。这里面告诉你可以用 -Dxxxx=xxx 设置参数
即:-D<name>=<value>
                  set a system property
----------------------
D:\j2sdk15\bin>java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

where options include:
    -client       to select the "client" VM
    -server       to select the "server" VM
    -hotspot      is a synonym for the "client" VM  [deprecated]
                  The default VM is client.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose[:class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
-----------------------------
在控制台输出信息中,有个-X(注意是大写)的命令,这个正是查看JVM配置参数的命令。

2
用java -X 命令还可以查看JVM的配置说明:
--------------------------
D:\j2sdk15\bin>java -X
    -Xmixed           mixed mode execution (default)
    -Xint             interpreted mode execution only
    -Xbootclasspath:<directories and zip/jar files separated by ;>
                      set search path for bootstrap classes and resources
    -Xbootclasspath/a:<directories and zip/jar files separated by ;>
                      append to end of bootstrap class path
    -Xbootclasspath/p:<directories and zip/jar files separated by ;>
                      prepend in front of bootstrap class path
    -Xnoclassgc       disable class garbage collection
    -Xincgc           enable incremental garbage collection
    -Xloggc:<file>    log GC status to a file with time stamps
    -Xbatch           disable background compilation
    -Xms<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
    -Xss<size>        set java thread stack size
    -Xprof            output cpu profiling data
    -Xfuture          enable strictest checks, anticipating future default
    -Xrs              reduce use of OS signals by Java/VM (see documentation)
    -Xcheck:jni       perform additional checks for JNI functions
    -Xshare:off       do not attempt to use shared class data
    -Xshare:auto      use shared class data if possible (default)
    -Xshare:on        require using shared class data, otherwise fail.

The -X options are non-standard and subject to change without notice.
-----------------------------------------------------------------------

3
JVM配置参数中文说明:
-------------------
1、-Xmixed           mixed mode execution (default)
混合模式执行

2、-Xint             interpreted mode execution only
解释模式执行

3、-Xbootclasspath:<directories and zip/jar files separated by ;>
      set search path for bootstrap classes and resources
设置zip/jar资源或者类(.class文件)存放目录路径

3、-Xbootclasspath/a:<directories and zip/jar files separated by ;>
      append to end of bootstrap class path
追加zip/jar资源或者类(.class文件)存放目录路径

4、-Xbootclasspath/p:<directories and zip/jar files separated by ;>
      prepend in front of bootstrap class path
预先加载zip/jar资源或者类(.class文件)存放目录路径

5、-Xnoclassgc       disable class garbage collection
关闭类垃圾回收功能

6、-Xincgc           enable incremental garbage collection
开启类的垃圾回收功能

7、-Xloggc:<file>    log GC status to a file with time stamps
记录垃圾回日志到一个文件。

8、-Xbatch           disable background compilation
关闭后台编译

9、-Xms<size>        set initial Java heap size
设置JVM初始化堆内存大小

10、-Xmx<size>        set maximum Java heap size
设置JVM最大的堆内存大小

11、-Xss<size>        set java thread stack size
设置JVM栈内存大小

12、-Xprof            output cpu profiling data
输入CPU概要表数据

13、-Xfuture          enable strictest checks, anticipating future default
执行严格的代码检查,预测可能出现的情况

14、-Xrs              reduce use of OS signals by Java/VM (see documentation)
通过JVM还原操作系统信号

15、-Xcheck:jni       perform additional checks for JNI functions
对JNI函数执行检查

16、-Xshare:off       do not attempt to use shared class data
尽可能不去使用共享类的数据

17、-Xshare:auto      use shared class data if possible (default)
尽可能的使用共享类的数据

18、-Xshare:on       require using shared class data, otherwise fail.
尽可能的使用共享类的数据,否则运行失败

The -X options are non-standard and subject to change without notice.

你可能感兴趣的:(java,jvm,thread,jni,OS)