• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to identify the Operating System?  RSS feed

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I am trying to print the name of the OS which my Java program is running. For an example, if it runs in windows, it should print "Windows OS", if Linux "Linux OS" like wise. How can I identify the OS? Please help..
 
Tim Moores
Saloon Keeper
Posts: 4032
94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.getProperty("os.name")
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:System.getProperty("os.name")


Thanks Tim. I really appreciate it Thanks again
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!