|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<OS>
jlibs.core.lang.OS
public enum OS
This enum contains values for each type of OS.
To get the current OS:
OS myos = OS.get();
System.out.println(myos);
To check whether your OS is windows or unix;
OS myos = OS.get();
System.out.println("isWindows: "+myos.isWindows());
System.out.println("isUnix: "+myos.isUnix());
When your OS is not recognized, OS.get() returns OS.OTHER
There is another usefult method which might be required rarely;
String osName = System.getProperty("os.name");
OS os = OS.get(osName);
This might be handy, if your app is distributed and and want to find out the os of remote JVM process
| Enum Constant Summary | |
|---|---|
COMPAQ_OPEN_VMS
|
|
COMPAQ_TRU64_UNIX
|
|
FREEBSD
|
|
HP_UX
|
|
IBM_AIX
|
|
LINUX
|
|
MAC
|
|
OS2
|
|
OTHER
Unrecognized OS |
|
SGI_IRIX
|
|
SOLARIS
|
|
SUN_OS
|
|
WINDOWS_2000
|
|
WINDOWS_7
|
|
WINDOWS_95
|
|
WINDOWS_98
|
|
WINDOWS_NT
|
|
WINDOWS_OTHER
|
|
WINDOWS_VISTA
|
|
| Method Summary | |
|---|---|
static OS |
get()
|
static OS |
get(String osName)
|
boolean |
isUnix()
|
boolean |
isWindows()
|
static OS |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static OS[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final OS WINDOWS_NT
public static final OS WINDOWS_95
public static final OS WINDOWS_98
public static final OS WINDOWS_2000
public static final OS WINDOWS_VISTA
public static final OS WINDOWS_7
public static final OS WINDOWS_OTHER
public static final OS SOLARIS
public static final OS LINUX
public static final OS HP_UX
public static final OS IBM_AIX
public static final OS SGI_IRIX
public static final OS SUN_OS
public static final OS COMPAQ_TRU64_UNIX
public static final OS MAC
public static final OS FREEBSD
public static final OS OS2
public static final OS COMPAQ_OPEN_VMS
public static final OS OTHER
| Method Detail |
|---|
public static OS[] values()
for (OS c : OS.values()) System.out.println(c);
public static OS valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is nullpublic boolean isWindows()
public boolean isUnix()
public static OS get(String osName)
osName - name of OS as returned by System.getProperty("os.name")
osNamepublic static OS get()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||