网站首页 新闻首页 网页设计图形动画软件编程网站开发办公软件操作系统数据库网络技术认证考试范文资料黑客攻防 书籍教程 进入论坛

Java虚拟机(JVM)参数配置说明

http://www.diybl.com/ 2008-3-11  网络 点击:  [ 评论 ]
文章搜索:    【点击打包该文章】

在Java、J2EE大型应用中,JVM非标准参数的配置直接关系到整个系统的性能。
JVM非标准参数指的是JVM底层的一些配置参数,这些参数在一般开发中默认即可,不需要任何配置。但是在生产环境中,为了提高性能,往往需要调整这些参数,以求系统达到最佳新能。
另外这些参数的配置也是影响系统稳定性的一个重要因素,相信大多数Java开发人员都见过“OutOfMemory”类型的错误。呵呵,这其中很可能就是JVM参数配置不当或者就没有配置没意识到配置引起的。

为了说明这些参数,还需要说说JDK中的命令行工具一些知识做铺垫。

首先看如何获取这些命令配置信息说明:
假设你是windows平台,你安装了J2SDK,那么现在你从cmd控制台窗口进入J2SDK安装目录下的bin目录,然后运行java命令,出现如下结果,这些就是包括java.exe工具的和JVM的所有命令都在里面。

-----------------------------------------------------------------------
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配置参数的命令。

其次,用java -X 命令查看JVM的配置说明:
运行后如下结果,这些就是配置JVM参数的秘密武器,这些信息都是英文的,为了方便阅读,我根据自己的理解翻译成中文了(不准确的地方还请各位博友斧正)
-----------------------------------------------------------------------
D:\j2sdk15\bin>java -X
     -Xmixed            mixed mode execution (default)
     -Xint              interpreted mode execution only
     -Xbootclasspath:<directories and zip/jar file

欢迎光临DIY部落,点击这里查看更多文章教程   【点击打包该文章】
如果图片或页面不能正常显示请点击这里 站内搜索:   
上一篇文章:JDBC基础(一)
下一篇文章:Java SE String类 [一]

文章评论

请您留言