aspose file tools*
The moose likes Beginning Java and the fly likes System Properties!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "System Properties!!" Watch "System Properties!!" New topic
Author

System Properties!!

Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
hi all,
could someone please explain me the use of system properties class that java provides? some of the books says that System properties are another mechanism used to parameterize a program at run time. but i can't see how? please help me.
thanks.
Anupama Dande
Greenhorn

Joined: May 09, 2003
Posts: 10
I think u should better go thru the following site, which explains neatly about the usage of the System Properties (i.e., Accessing System Resources at Runtime).
http://java.sun.com/docs/books/tutorial/essential/system/properties.html
It's nifty to work with this... Enjoy urself too...
Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
hi,
like you suggested, i read about the system properties class in the following site.
Originally posted by Anupama Dande:
I think u should better go thru the following site, which explains neatly about the usage of the System Properties (i.e., Accessing System Resources at Runtime).
http://java.sun.com/docs/books/tutorial/essential/system/properties.html


But i still can't see how we can make use of this feature to parameterize a program at run time. could you please give me some real world instances we could make use of this features?
Also, when i read an example, this features let us know things like "file.separator","java.class.path","java.class.version","os.name"...etc. why do we need to know these at run time?
please help me.
thanks.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi sathi
Also, when i read an example, this features let us know things like "file.separator","java.class.path","java.class.version","os.name"...etc. why do we need to know these at run time?
we need to have them at run time in case we want to migrate code across various platforms.
for e.g. if we code using file separator as "/" which is for Unix based systems then we have to change it when we give our program to a friend running windows as the file separator is "\" on windows.
well, u might think this is just a little change but its better to avoid that as well in cases when v r going to provide the compiled classes ONLY to the others for running them and we don't know which system they have...
to give u an example of the use of "runtime" properties,
there r some java properties which certain APIs uses and we can specify their values using switches like "-D" at runtime. u can go to,
RMI tutorial page which one of the many examples how ppl use "-D" switch and specify property values at run time for,
java.rmi.server.codebase etc...
u can use those properties with System.getProperty("java.rmi.server.codebase") as well...u know..
hope u c some direction here
regards
maulin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: System Properties!!