Skip to content
Permalink
Browse files
8274840: Update OS detection code to recognize Windows 11
Backport-of: 97ea9dd2f24f9f1fb9b9345a4202a825ee28e014
  • Loading branch information
Olga Mikhaltsova authored and Yuri Nesterenko committed Oct 21, 2021
1 parent e2012a2 commit 5075dec84576b0a08cabe7a6d033cae1c24040aa
Showing with 15 additions and 2 deletions.
  1. +5 −1 src/hotspot/os/windows/os_windows.cpp
  2. +10 −1 src/java.base/windows/native/libjava/java_props_md.c
@@ -1712,7 +1712,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 by build number
// - 2016 GA 10/2016 build: 14393
@@ -468,6 +468,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)
@@ -541,7 +543,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 {

1 comment on commit 5075dec

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 5075dec Oct 21, 2021

Please sign in to comment.