How to get Operating System name using Java


In this article, we will learn how to print or find Operating System name on which your Java Application is running by writing a simple Code.

To Find Operating System(OS) Name using Java, we use "" Environment variable, as each OS, stores its name in this property.

public class FindOS { public static void main(String args[]) { String os = System.getProperty(""); System.out.print("Your OS is "+os); } }


Your OS is Linux

Want to Clear Java Interview? Read Java Interview Notes prepared by Us

Are You Good enough in Java? Prove it!



Our Website is viewed by more than 400K Technical Enthusiasts every month.
For Sponsored Advertisement OR Guest Posts, Contact us at

Facing Programming Errors. Get Answers within 24 hours:

Ebook Download
Quiz For You:
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags

    Find Operating System name using Java language

    OS name using Java