This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Setting system properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Setting system properties" Watch "Setting system properties" New topic
Author

Setting system properties

Patrick ODonnell
Ranch Hand

Joined: Nov 28, 2001
Posts: 31
Hi all,
Just a quick question. Can you set system properties from a Java Application? For example I want to set the JAVA_HOME property, how would this be done?
I know there is a,
System.setProperty()
But how is this used?
Thanks,
Patrick
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
You can change some properties local to java, but the change isn't permanent - it only lasts while the java app is running. It's like changing environment variables in a batch file - when the file is done running and the command window it launces exits, those settings get undone.
Setting JAVA_HOME would require some kind of access to the native environment variables - I don't think you can do this without using JNI, and then of course it's not portable.


Rob
SCJP 1.4
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Setting system properties
 
Similar Threads
What is the java -D command-line option good for?
How to set system properties permanently?
Ant: print all System properties.
Setting System Properies in WAS 5.0
Ant and system properties