How to get Operating System name using Java

[1138 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
                 



Clear Any Java Interview by Reading our Ebook Once.


Can you clear Java Interview?




Comments










Search Anything:

Sponsored Deals ends in



Interesting Technical Quizzes:

Search Tags

    Find Operating System name using Java language

    OS name using Java