Saturday, June 16, 2012

Detect OS using Java : System.getProperty()

public class OSInfo {
    public static void main(String[] args) {

        System.out.println("** Operating System Info **");
        System.out.println();
        System.out.println("Name : " + System.getProperty("os.name"));
        System.out.println("Arch. : " + System.getProperty("os.arch"));
        System.out.println("Version : " + System.getProperty("os.version"));

    }
}

No comments:

Post a Comment