How to Get Operating System Name using Java

In this article, you will learn how to get the operating system’s name that a java program runs on. It’s a reasonably easy code that uses the getProperty() function from the System class and then uses the property to print out the name of the Operation System.

More like this:

Get Operation system Name Using Java

public class Main {

  public static void main(String args[]) {
    try {

      String operationSystemName = "";

      operationSystemName = System.getProperty("");
      System.out.println("You are running a " + operationSystemName + " Operation System.");
    } catch (Exception e) {



You are running a Linux Operation System.