Java - Get Operating System Name using System Class in Java.


IncludeHelp 19 July 2016

In this code snippet we will learn how to get Operating System Name using System class in Java. Java provided System class, by using getProperty() method of System class with "os.name" parameter we can access the Operating System name on which program is running.

Java Code Snippet - Get O.S. Name using System Class

//Java - Get Operating System Name using System Class in Java.

public class GetOSName{	

	public static void main(String args[]){
		  String osName="";
		  
		  osName=System.getProperty("os.name");
		  System.out.println("Your operating system is: " + osName);		 
	  }
}
    

    Your operating system is: Windows 8.1



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.