java get Operating System name
Many times we need to know the current operating system name on which we are working. So in java we have "os.name" property which provides us the information about the current operating system name. We can get the current operating system's name by using the getProperty() method of java.lang.System in which we have to pass the property name as "os.name".
String osName= System.getProperty("os.name");
Above line of java code gets the OS name and assign it to a string variable. Now by printing this we can show the current operating system's name. Here is the full code of GetOSName.java as follows:
Operating system name =>Windows 2000
Download Source Code
Recommend the tutorial