java代码结构优化 java代码性能优化( 三 )


录下的bin目录,然后运行java命令,出现如下结果,这些就是包括java.exe工具的和
JVM的所有命令都在里面 。
-----------------------------------------------------------------------
D:\j2sdk15\binjava
Usage: java [-options] class [args...]
(to execute a class)
orjava [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-clientto select the "client" VM
-serverto select the "server" VM
-hotspotis 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.
-Dname=value
set a system property
-verbose[:class|gc|jni]
enable verbose output
-versionprint product version and exit
-version:value
require the specified version to run
-showversionprint product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -helpprint this help message
-Xprint 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配置参数的命
令 。
其次,用java -X 命令查看JVM的配置说明:
运行后如下结果,这些就是配置JVM参数的秘密武器,这些信息都是英文的,为了方便
阅读,我根据自己的理解翻译成中文了(不准确的地方还请各位博友斧正)
-----------------------------------------------------------------------
D:\j2sdk15\binjava -X
-Xmixedmixed mode execution (default)
-Xintinterpreted 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
-Xnoclassgcdisable class garbage collection
-Xincgcenable incremental garbage collection
-Xloggc:filelog GC status to a file with time stamps
-Xbatchdisable background compilation
-Xmssizeset initial Java heap size
-Xmxsizeset maximum Java heap size
-Xsssizeset java thread stack size
-Xprofoutput cpu profiling data
-Xfutureenable strictest checks, anticipating future default
-Xrsreduce use of OS signals by Java/VM (see
documentation)
-Xcheck:jniperform additional checks for JNI functions
-Xshare:offdo not attempt to use shared class data
-Xshare:autouse shared class data if possible (default)
-Xshare:onrequire using shared class data, otherwise fail.
The -X options are non-standard and subject to change without notice.
-----------------------------------------------------------------------
JVM配置参数中文说明:
-----------------------------------------------------------------------

推荐阅读