Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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 5075dec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/hotspot/os/windows/os_windows.cpp
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/java.base/windows/native/libjava/java_props_md.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

1 comment on commit 5075dec

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.