Java operating systems: Difference between revisions

From wikinotes
 
m (Will moved page Java targeting platforms to Java operating systems without leaving a redirect)
 
(No difference)

Latest revision as of 02:41, 24 June 2022

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 {
}