Tomcat等应用启动脚本中的-D参数 [java的系统参数传递]

今天在测试jvm的调整优化过程中,在网上查资料时发现解决方法里有这么一句   

修改tomcat的Djava.io.tmpdir参数,统一使用/tmp目录,修改catalina.sh添加CATALINA_TMPDIR=/tmp即可

有一个-D的的参数与是上网查了些资料

能够理解是设置一些属性,在运行时再获取,但为什么是-D一直没搞清,今天网上看到一个java -D的写法,才明白,原来是java运行参数,和-cp,-verbose这一类的差不多。
最终这些-D参数可以在代码中用 下面代码来获取

1 System.getProperty(catalina.home"); //-D后相应的参数

PS:

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  

 

posted @ 2016-11-20 13:32  十二十二  阅读(619)  评论(0)    收藏  举报