Source Code : Operating System
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Operating System
/**
* This file is distributed under the GPL
* $Id: OperatingSystem.java 1869 2009-09-02 07:02:35Z scotta $
*/
//package net.bnubot.util;
import java.util.Properties;
/**
* @author scotta
*/
public enum OperatingSystem {
WINDOWS,
OSX,
LINUX,
UNKNOWN;
private static OperatingSystem initOS() {
String osName = System.getProperty("os.name");
if(osName.equals("Mac OS X"))
return OSX;
if(osName.startsWith("Windows "))
return WINDOWS;
if(osName.startsWith("Linux"))
return LINUX;
return UNKNOWN;
}
public static final OperatingSystem userOS = initOS();
/**
* @return user-displayable operating system version
*/
public static String osVersion() {
Properties p = System.getProperties();
String osName = p.getProperty("os.name");
String osVersion = p.getProperty("os.version");
if((osVersion != null) && (osVersion.length() != 0))
osName += " " + osVersion;
switch(userOS) {
case OSX:
if(osVersion.startsWith("10.0"))
osName += " Cheetah";
else if(osVersion.startsWith("10.1"))
osName += " Puma";
else if(osVersion.startsWith("10.2"))
osName += " Jaguar";
else if(osVersion.startsWith("10.3"))
osName += " Panther";
else if(osVersion.startsWith("10.4"))
osName += " Tiger";
else if(osVersion.startsWith("10.5"))
osName += " Leopard";
else if(osVersion.startsWith("10.6"))
osName += " Snow Leopard";
break;
case WINDOWS:
osName += " " + p.getProperty("sun.os.patch.level");
break;
}
osName += " (" + p.getProperty("os.arch") + ")";
return osName;
}
public static String javaVersion() {
return "Java " + System.getProperties().getProperty("java.version");
}
}
Thank with us