harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Shimansky <gshiman...@gmail.com>
Subject Re: [classlib][security] Changing system property java.home may cause incorrect initialization of java.security.Security class
Date Fri, 24 Nov 2006 21:04:34 GMT
On Friday 24 November 2006 23:17 Tim Ellison wrote:
> Geir Magnusson Jr. wrote:
> > Tim Ellison wrote:
> >> Geir Magnusson Jr. wrote:
> >>> Isn't java.home set on vm start and immutable?
> >>
> >> No.
> >
> > "No" what?
> ?? It is untrue that java.home is set on vm start and immutable.

Probably Geir meant internal native VM value for java.home property. Java 
program cannot change that. Even setting this property with -D command line 
switch won't give any effect on drlvm because it will be overridden on the 
initialization... and now that I've written it and tried to override 
java.home on command line, drlvm crashed :(

The bug however seems to be in the launcher because it didn't set 
org.apache.harmony.boot.class.path to any value, so the property is NULL. I'm 
going to take a look (recompiling classlib with debug since it has no symbols 
by default).

> e.g.
>   public static void main(String[] args) {
>     System.out.println(System.getProperty("java.home"));
>     System.setProperty("java.home", "anything I want it to be");
>     System.out.println(System.getProperty("java.home"));
>   }
> produces:
>   C:\java\IBM JDK 5.0\SR3\jre
>   anything I want it to be

Yes this changes the property on java level, but VM ignores the change or it 
should better do it. So on the native level the property is immutable and set 
on VM startup.


View raw message