java -Daaa=xxx 是java运行参数的语法
注意:名称=值之间没有空格
作用是配置一些环境变量,具体有哪些参数,参数有什么效果,和你用的实际环境、项目架构都有关
// -
// java -D<name>=<value> (注意:没有空格)
// java
/*
2 import java.util.Properties;
3
4 public class SysPropTest {
5
6 /**
7 * @param args
8 */
9 public static void main(String[] args) {
10 Properties p = System.getProperties();
11 Enumeration < String > names = (Enumeration < String > )p.propertyNames();
12 while (names.hasMoreElements()) {
13 String string = (String) names.nextElement();
14 System.out.println(string + " = " + p.getProperty(string));
15 }
16 }
17 }
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=D:\MyProgram\Java\jdk1.6.0_10\jre\bin
java.vm.version=11.0-b15
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.country=CN
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 3
java.vm.specification.name=Java Virtual Machine Specification
user.dir=F:\workspace\workspace_oss_new\JVM
java.runtime.version=1.6.0_10-rc2-b32
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=D:\MyProgram\Java\jdk1.6.0_10\jre\lib\endorsed
os.arch=x86
java.io.tmpdir=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\
line.separator=
java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows XP
sun.jnu.encoding=GBK
java.library.path=D:\MyProgram\Java\jdk1.6.0_10\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:/MyProgram/Java/jdk1.6.0_10/bin/../jre/bin/client;D:/MyProgram/Java/jdk1.6.0_10/bin/../jre/bin;D:\MyProgram\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;D:\MyProgram\Sybase\shared;%Java_home%\bin;%Java_home_16%\bin;D:\MyProgram\Java\TortoiseSVN\bin;D:\MyProgram\Rational\common;D:\MyProgram\Java\JDK5\bin
java.specification.name=Java Platform API Specification
java.class.version=50.0
sun.management.compiler=HotSpot Client Compiler
os.version=5.1
user.home=C:\Documents and Settings\Administrator
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=GBK
java.specification.version=1.6
user.name=Administrator
java.class.path=F:\workspace\workspace_oss_new\JVM\bin
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=D:\MyProgram\Java\jdk1.6.0_10\jre
java.specification.vendor=Sun Microsystems Inc.
user.language=zh
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode, sharing
java.version=1.6.0_10-rc2
java.ext.dirs=D:\MyProgram\Java\jdk1.6.0_10\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
sun.boot.class.path=D:\MyProgram\Java\jdk1.6.0_10\jre\lib\resources.jar;D:\MyProgram\Java\jdk1.6.0_10\jre\lib\rt.jar;D:\MyProgram\Java\jdk1.6.0_10\jre\lib\sunrsasign.jar;D:\MyProgram\Java\jdk1.6.0_10\jre\lib\jsse.jar;D:\MyProgram\Java\jdk1.6.0_10\jre\lib\jce.jar;D:\MyProgram\Java\jdk1.6.0_10\jre\lib\charsets.jar;D:\MyProgram\Java\jdk1.6.0_10\jre\classes
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
cmd:java -?
the result shows like below:
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 [depreca
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar
A ; separated list of directories, JAR arc
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 v
-? -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.
see also, -agentlib:jdwp=help and -agent
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see
-splash:<imagepath>
show splash screen with specified image