JBR-3874 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
committed by Vitaly Provodin
parent 01304991d3
commit 51a590b2e8
2 changed files with 15 additions and 2 deletions

View File

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

View File

@@ -475,6 +475,8 @@ GetJavaProperties(JNIEnv* env)
* Windows Server 2012 6 2 (!VER_NT_WORKSTATION)
* Windows Server 2012 R2 6 3 (!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 2019 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 17762)
@@ -546,7 +548,14 @@ GetJavaProperties(JNIEnv* env)
} else if (majorVersion == 10) {
if (is_workstation) {
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)";
}
} else {