How does Java determine the name of the operating system?

In the beginning, I want to mention that this does not duplicate this section .

I know that I can verify that the OS I run with Java programmatically with System.getProperty("os.name");

My question is: how does Java define my operating system? Other words, when Propertiesare downloaded / installed (especially os.name) and what command is executed for this?

UPDATE

Not a duplicate. Where (in which properties file) does System.getProperty ("key") work from? . I do not ask where the properties are stored. Im requests a command that is used to determine the name of the OS.

As @Phylogenesis commented - on Windows it uses GetVersionEx internally in its own implementation of c.

What about Unix / Linux?

+4
source share
1 answer

Just check out the OpenJDK source code .

+4
source

Source: https://habr.com/ru/post/1658931/


All Articles