Java operating systems

From wikinotes
Revision as of 02:41, 24 June 2022 by Will (talk | contribs) (Will moved page Java targeting platforms to Java operating systems without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Platform Info

list of all system properties https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#getProperties()
System.getProperty("os.name");      // 
System.getProperty("os.version");   // 
System.getProperty("os.arch");      //

check os family

osname = System.getProperty("os.name");
if (osNameMatch.contains("linux")) {
    osname = OS_LINUX;
} else if(osNameMatch.contains("windows")) {
    osname = OS_WINDOWS;
} else if(osNameMatch.contains("solaris") || osNameMatch.contains("sunos")) {
    osname = OS_SOLARIS;
}else if(osNameMatch.contains("mac os") || osNameMatch.contains("macos") || osNameMatch.contains("darwin")) {
    osname = OS_MAC_OS_X;
}else {
}