実行クラスに関する情報の取得


System.getProperties().list(System.out);

出力結果:
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files\Genuitec\Common\bina...
java.vm.version=11.3-b02
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=D:\Workspaces\ZL
java.runtime.version=1.6.0_13-b03
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Genuitec\Common\bina...
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=C:\Program Files\Genuitec\Common\bina...
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=D:\Workspaces\ZL\WebRoot\WEB-INF\clas...
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=C:\Program Files\Genuitec\Common\bina...
java.specification.vendor=Sun Microsystems Inc.
user.language=zh
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.6.0_13
java.ext.dirs=C:\Program Files\Genuitec\Common\bina...
sun.boot.class.path=C:\Program Files\Genuitec\Common\bina...
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=

クラスパスまたはファイルパスを取得するいくつかの方法
1、
ClassA.class.getResource("ClassA.class").getPath() //        ,""             
ClassA.class.getResource("").getPath()  //         

ClassA.class.getClassLoader().getSystemResource("").getPath();//  class        
ClassA.class.getClassLoader().getSystemResource("test/ClassA.class").getPath();//        

2、
Thread.currentThread().getContextClassLoader().getResource("").getPath()