- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to get Operating System name and version
Use the System.getProperty() method in Java to get the Operating System name and version.
It’s syntax is −
String getProperty(String key)
Above, the key is the name of the system property. Since, we want the OS name and version, therefore we will add the key as −
Operating System name - os.name Operating System version - os.version
The following is an example −
Example
public class Demo { public static void main(String []args){ System.out.println("OS Name: " + System.getProperty("os.name")); System.out.println("OS Version: " + System.getProperty("os.version")); } }
Output
OS Name: Linux OS Version: 3.10.0-862.9.1.el7.x86_64
- Related Articles
- Java Program to determine the name and version of the operating system
- Haskell Program to determine the name and version of the operating system
- Display the Operating System name in Java
- Get Operating System temporary directory / folder in Java
- How to get android application version name?
- Difference Between Network Operating System and Distributed Operating System
- Java Program to get full day name
- Java program to Get IP address of the system
- Java Program to get name of parent directory
- How to get Java and OS version, vendor details in JShell in Java 9?
- Difference between a Centralised Version Control System (CVCS) and a Distributed Version Control System (DVCS)
- Operating System Design and Implementation
- How to get the application name and version information of a browser in JavaScript?
- Operating System Structure
- Operating System Operations

Advertisements