Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining the OS 1

Status
Not open for further replies.

daniel87dec

Technical User
Jan 7, 2004
9
CA
Hello.
Can somebody please tell me how I can determine the operating system of the computer on which the program is being run. Is there a function in java that does that? Also, is there a function in java that lets you determine the version of java installed on the computer?

Thanks in advance.
 
You want :
Code:
System.getProperty("os.name");
System.getProperty("java.version");

This is how you get all available System properties :


Code:
     for (Enumeration e = System.getProperties().propertyNames() ; e.hasMoreElements() ;) {
         String propName = (String)e.nextElement();
         System.out.println(propName +"=" +System.getProperty(propName));
     }

In future, it is better to post on forum269 as this one doesn't get much traffic ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top