is Windows from system properties - Java java.util

Java examples for java.util:Properties File

Description

is Windows from system properties

Demo Code


import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;

public class Main{
    public static void main(String[] argv) throws Exception{
        System.out.println(isWindowsOS());
    }//w  w  w.j  a v a2 s . c  om
    
    public static boolean isWindowsOS() {
        boolean isWindowsOS = false;
        String osName = System.getProperty("os.name");
        if (osName.toLowerCase().indexOf("windows") > -1) {
            isWindowsOS = true;
        }
        return isWindowsOS;
    }
}

Related Tutorials