undefined system properties

158 views
Skip to first unread message

chpkim

unread,
Apr 16, 2012, 5:53:54 AM4/16/12
to Java™ Pathfinder
Hi,

When I run an application that retrieves system properties, e.g.
System.getProperty("java.specification.version") and
System.getProperty("java.vm.version"), I get null pointer exceptions
because these calls seem to be returning null values. Is there a way
to have these properties set as a vendor (e.g. Sun) would have them
set?

Thank you.

ajedwards

unread,
Apr 16, 2012, 9:19:10 AM4/16/12
to Java™ Pathfinder
Hi,

Which Java JDK and JRE are you using and which version?

The Oracle Java api documentation [1] shows the
java.lang.System.getProperties() method and the respective System
properties listed and suggests that if you are using the above
correctly then there should not be null pointers returned.

[1] http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#getProperties()

Please provide further information (stack trace and Java version
information).

Andrew

Peter Mehlitz

unread,
Apr 16, 2012, 1:54:16 PM4/16/12
to java-pa...@googlegroups.com
JPF has three different ways to model system properties:

- selected : keys specified as 'vm.sysprop.keys', values copied from host VM
- file : Java properties file (key=value pairs)
- host : all system properties from underlying host VM

The default configuration in jpf.properties is 'selected', but the default keys that are copied only include
"path.separator",
"line.separator",
"file.separator",
"user.name",
"user.dir",
"user.timezone",
"user.country",
"java.home",
"java.version",
"java.class.path"

If you need more, you have to specify the keys with the "vm.sysprop.keys" property as a comma separated list of strings

-- Peter

Reply all
Reply to author
Forward
0 new messages