System.getProperty("os.name")

Here is a handy Java class that useSystem.getProperty("os.name") to detect which type of operating system (OS) you are using now. This code can detect “Windows”, “Mac”, “Unix” and “Solaris”

原文地址:https://www.cnblogs.com/kakaisgood/p/9492399.html