You may refer this:
System.getProperty("os.name")
You may find this code useful:
class ShowProperties {
public static void main(String[] args) {
System.getProperties().list(System.out);
}
}
I hope this helps!
Enroll for our Java Training to learn more about Java programming.
Thanks!