8274840: Update OS detection code to recognize Windows 11

Co-authored-by: Arno Zeller <arno.zeller@sap.com>
Reviewed-by: clanger, dholmes
This commit is contained in:
Matthias Baesken 2021-10-08 06:40:18 +00:00
parent 8de77634c4
commit 97ea9dd2f2
2 changed files with 15 additions and 2 deletions

View file

@ -1858,7 +1858,11 @@ void os::win32::print_windows_version(outputStream* st) {
case 10000: case 10000:
if (is_workstation) { if (is_workstation) {
st->print("10"); if (build_number >= 22000) {
st->print("11");
} else {
st->print("10");
}
} else { } else {
// distinguish Windows Server by build number // distinguish Windows Server by build number
// - 2016 GA 10/2016 build: 14393 // - 2016 GA 10/2016 build: 14393

View file

@ -471,6 +471,8 @@ GetJavaProperties(JNIEnv* env)
* Windows Server 2012 6 2 (!VER_NT_WORKSTATION) * Windows Server 2012 6 2 (!VER_NT_WORKSTATION)
* Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION) * Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION)
* Windows 10 10 0 (VER_NT_WORKSTATION) * Windows 10 10 0 (VER_NT_WORKSTATION)
* Windows 11 10 0 (VER_NT_WORKSTATION)
* where (buildNumber >= 22000)
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION) * Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
* Windows Server 2019 10 0 (!VER_NT_WORKSTATION) * Windows Server 2019 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 17762) * where (buildNumber > 17762)
@ -544,7 +546,14 @@ GetJavaProperties(JNIEnv* env)
} else if (majorVersion == 10) { } else if (majorVersion == 10) {
if (is_workstation) { if (is_workstation) {
switch (minorVersion) { switch (minorVersion) {
case 0: sprops.os_name = "Windows 10"; break; case 0:
/* Windows 11 21H2 (original release) build number is 22000 */
if (buildNumber >= 22000) {
sprops.os_name = "Windows 11";
} else {
sprops.os_name = "Windows 10";
}
break;
default: sprops.os_name = "Windows NT (unknown)"; default: sprops.os_name = "Windows NT (unknown)";
} }
} else { } else {