ADVERTISEMENT
ADVERTISEMENT

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

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.