Java Reference
In-Depth Information
36. java.vm.specification.version = 1.0
37. sun.arch.data.model = 32
38. java.home = C: \ Program Files \ Java \ jdk1.5.0 \ jre
39. java.specification.vendor = Sun Microsystems Inc.
40. user.language = en
41. awt.toolkit = sun.awt.windows.WToolkit
42. java.vm.info = mixed mode, sharing
43. java.version = 1.5.0-beta2
44. java.ext.dirs = C:\Program Files\Java\jdk1.5.0\jre\
lib\ext
45. sun.boot.class.path = C:\Program Files\Java\jdk1.5.0\
jre\lib\rt.jar;
C:\Program Files\Java\jdk1.5.0\jre\lib\i18n.jar;
C:\Program Files\Java\jdk1.5.0\jre\lib\sunrsasign.jar;
C:\Program Files\Java\jdk1.5.0\jre\lib\jsse.jar;
C:\Program Files\Java\jdk1.5.0\jre\lib\jce.jar;
C:\Program Files\Java\jdk1.5.0\jre\lib\charsets.jar;
C: \ Program Files \ Java \ jdk1.5.0 \ jre \ classes
46. java.vendor = Sun Microsystems Inc.
47. file.separator =\
48. java.vendor.url.bug =
http://java.sun.com/cgi-bin/bugreport.cgi
49. sun.cpu.endian = little
50. sun.io.unicode.encoding = UnicodeLittle
51. sun.desktop = windows
52. sun.cpu.isalist =
From this output, you can see that the list of system properties includes many
useful and interesting items. Everything you might need or want to know is not
included there, however. One thing that is missing is a list of operating system
or command shell environment variables. Alas, unlike C or C
, there is no
getEnv() method in Java. Part of the reason is that Java could conceivably be
runonaplatform that does not support the concept of environment variables.
The expected way to pass environment-variable-like values to a Java application
is with the - Dname = value syntax seen a few times in earlier chapters. Using
the - D syntax on the java command line effectively adds the specified name and
value to the list of system properties. Therefore, if you need to send a system
environment variable named SomeEnvVar to your Java code, you can include it
on the command line like this:
++
java -Dsome.env.variable = $SomeEnvVar YourClass (Unix/Linux)
or
java -Dsome.env.variable = %SomeEnvVar% YourClass (Windows)
 
Search WWH ::




Custom Search