• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Determine windows, unix or other OS?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can java programmed to detect what os is running on the remote host?..

if cannot, is there any other ways to detect the OS?.


thanks
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can detect which os is running by using the following code:

String os = System.getProperty("os.name");

It will return something like "Windows 2000".

You can get all the properties by running the following code:

Properties props = System.getProperties();

// Enumerate all system properties
Enumeration enum = props.propertyNames();
for (; enum.hasMoreElements() ;) {
// Get property name
String propName = (String) enum.nextElement();

// Get property value
String propValue = (String) props.get(propName);
System.out.println(propName + " - " + propValue);
}
[ June 30, 2005: Message edited by: Richard Nienaber ]
 
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic