How to get OS Information using Java Program

Get OS Information using Java

In this tutorial, We will show you to write program about, How to Get OS Information using Java. The example java program were tested with environment and output is shared in the same post.

OSInformation.java

The following OSInformation class used to get information such as OS Name, OS Version, and OS Architecture etc. In Java we have predefined API`s and methods to get those information using java.lang.System.getProperty(key). by passing the appropriate key we can able to get the value accordingly. You find the sample java program below.

Output

—————–

OS Information
————————–
OS Name : Windows 8.1
OS Version : 6.3
OS Architecture : x86