How to get Operating System name using Java

[246 views]



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 "os.name" Environment variable, as each OS, stores its name in this property.

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

Output:

Your OS is Linux
        



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


Are You Good enough in Java? Prove it!



Comments



Search

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




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