How to get operating System information in java swing

You can check your operating system’s details by the java code.For this you have to use the built in properties “os.name” and “os.version”. on.name returns the name of operating system and on.version returns the version number.
Sample code for retrieving OS information:
{code codetype=php}
public class OSinfo
{
public static void main(String args[]) {
try{
String osName= System.getProperty(“os.name”);
String osVersion= System.getProperty(“os.version”);

System.out.println(“Operating system details =>”+ osName + osVersion);
}catch (Exception e){
System.out.println(“Exception caught =”+e.getMessage());
}
}
}{/code}
class OSinfo returns the OS name and version.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Related Posts

Related Posts with Thumbnails

About the Author

techremind

has written 42 stories on this site.

Write a Comment

Copyright © 2012 CoreTimer.com|System Admin’s Reference. All rights reserved.

Switch to our mobile site