Problem with system properties

Bryce McKinlay bryce@waitaki.otago.ac.nz
Thu Jun 20 19:24:00 GMT 2002


Compare the output of this test case using the current GCC/classpath 
compared with GCC 3.1 or  the JDK:

public class PropTest
{
  public static void main(String[] args)
  {
    System.out.println (System.getProperties());
  }
}

The problem (introduced into GCJ by a classpath merge) makes it 
impossible to get a list of all the system properties which are defined, 
because the "real" system properties are now just default properties for 
the properties object that is returned by System.getProperties()

While looking for a fix, I wonder why system property initialization was 
moved from System to Runtime. The comments mention something about VM 
bootstrapping, but I don't understand why it makes a difference in this 
case - System.<clinit> calls loadLibrary which will cause Runtime to be 
initialized anyway, so property initialization occurs at basically the 
same time. It would make more sense to me to keep the properties init 
code in System. Comments?

regards

Bryce.




More information about the Java mailing list