[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: new feature
On Fri, 3 Nov 2000, Angelo Schneider wrote:
> Hi,
>
> Java programs CAN read enviroment Variables.
> System.getProperties() returns a java.util.Property, the
> keys are the names of the environment variables and the
> values are the associted strings.
> However, AFAIK System.getProperties() contains not only
> the environment variables but also jvm settings.
I just tested this claim.
Here's what I get running the attached file:
plam@plam:~/propTest$ export SOOT_CLASSPATH=foo:bar
plam@plam:~/propTest$ java propTest
java.runtime.name: Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path: /usr/local/pkgs/jdk1.3/jre/lib/i386
java.vm.version: 1.3.0rc1-b17
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
java.vm.specification.name: Java Virtual Machine Specification
user.dir: /home/plam/propTest
java.runtime.version: 1.3.0rc1-b17
java.awt.graphicsenv: sun.awt.X11GraphicsEnvironment
os.arch: i386
java.io.tmpdir: /tmp
line.separator:
java.vm.specification.vendor: Sun Microsystems Inc.
java.awt.fonts:
os.name: Linux
java.library.path:
/usr/local/pkgs/jdk1.3/jre/lib/i386:/usr/local/pkgs/jdk1.3/jre/lib/i386/native_threads/:/usr/local/pkgs/jdk1.3/jre/lib/i386/client:/usr/local/pkgs/jdk1.3/jre/../lib/i386
java.specification.name: Java Platform API Specification
java.class.version: 47.0
os.version: 2.2.17
user.home: /home/plam
user.timezone:
java.awt.printerjob: sun.awt.motif.PSPrinterJob
file.encoding: ISO-8859-1
java.specification.version: 1.3
user.name: plam
java.class.path: .
java.vm.specification.version: 1.0
java.home: /usr/local/pkgs/jdk1.3/jre
user.language: en
java.specification.vendor: Sun Microsystems Inc.
java.vm.info: mixed mode
java.version: 1.3.0rc1
java.ext.dirs: /usr/local/pkgs/jdk1.3/jre/lib/ext
sun.boot.class.path:
/usr/local/pkgs/jdk1.3/jre/lib/rt.jar:/usr/local/pkgs/jdk1.3/jre/lib/i18n.jar:/usr/local/pkgs/jdk1.3/jre/lib/sunrsasign.jar:/usr/local/pkgs/jdk1.3/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
user.region: US
sun.cpu.isalist:
I couldn't find any mention of SOOT_CLASSPATH in there at all. Looks like
getProperties() only returns system properties.
pat
import java.util.*;
public class propTest
{
public static void main(String[] argv)
{
Properties props = System.getProperties();
Enumeration en = props.propertyNames();
while (en.hasMoreElements())
{
String key = (String)en.nextElement();
System.out.println(key + ": " + props.getProperty(key));
}
}
}