package org.kodejava.lang;
public class OperatingSystemInfo {
public static void main(String[] args) {
// The key for getting operating system name
String name = "os.name";
// The key for getting operating system version
String version = "os.version";
// The key for getting operating system architecture
String architecture = "os.arch";
System.out.println("Name : " + System.getProperty(name));
System.out.println("Version: " + System.getProperty(version));
System.out.println("Arch : " + System.getProperty(architecture));
}
}
Below is the example result of our program, of course it could be different from what you’ll see in your machine because it depends on the operating system that you use.
Name : Windows 10
Version: 10.0
Arch : amd64
Or
Name : Mac OS X
Version: 10.12.6
Arch : x86_64
Latest posts by Wayan (see all)
- How do I get number of each day for a certain month in Java? - September 8, 2024
- How do I get operating system process information using ProcessHandle? - July 22, 2024
- How do I sum a BigDecimal property of a list of objects using Java Stream API? - July 22, 2024