Saturday, February 10, 2007

How can I tell the type of machine and OS my Java program is running on?

A set of system properties, accessible via the getSystemProperties() method of class System allows you to get all sorts of useful information.

class GetPropertyDemo
{
public static void main(String args[])
{
// Display value for machine type and OS
System.out.println ( System.getProperty("os.arch") +
" running " +
System.getProperty("os.name") );
}
}


SOURCE : www.referjava.com

No comments: