Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting a system.property twice in a same JVM

843798Feb 23 2004 — edited Feb 26 2004
Hello,

I have got a problem concerning the setting of a system property.
When I run a first time my program I test a case by setting a system property, that works fine.
Now I want to change the same property in the same JVM by doing:
System.setProperties("key","oldvalue");
System.getProperties("key", "oldvalue"); //I obtain oldvalue
System.setProperties("key","newvalue");
System.getProperties("key", "newvalue"); //I obtain newvalue
But apparently it seems the JVM doesn't take the new value of the property even if the getProperty() give me the new value.
So my question is can I change several times the value of a same property in the same JVM or it is technically not possible?

I read the tutorial about System and it says :"The setProperties method changes the set of system properties for the current running application "

Thank you for any assistance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2004
Added on Feb 23 2004
6 comments
942 views