Java examples for Native OS:OS
Determine operating system using System class
public class Main { public static void main(String[] args) { String strOSName = System.getProperty("os.name"); System.out.print("Get OS name example.. OS is "); if (strOSName != null) { if (strOSName.toLowerCase().indexOf("windows") != -1) System.out.println("Windows"); else/* w ww .j a va 2s.co m*/ System.out.print("not windows"); } } }