Skip to content
Permalink
Browse files
8274840: Update OS detection code to recognize Windows 11
Co-authored-by: Arno Zeller <arno.zeller@sap.com>
Reviewed-by: clanger, dholmes
  • Loading branch information
MBaesken and ArnoZeller committed Oct 8, 2021
1 parent 8de7763 commit 97ea9dd2f24f9f1fb9b9345a4202a825ee28e014
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
@@ -1858,7 +1858,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
@@ -471,6 +471,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)
@@ -544,7 +546,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 {

3 comments on commit 97ea9dd

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot replied Oct 8, 2021

@TheRealMDoerr

This comment has been minimized.

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr replied Oct 13, 2021

/backport jdk11u-dev

@openjdk

This comment has been minimized.

Copy link

@openjdk openjdk bot replied Oct 13, 2021

@TheRealMDoerr @TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-97ea9dd2 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 97ea9dd2 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 8 Oct 2021 and was reviewed by Christoph Langer and David Holmes.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-97ea9dd2:TheRealMDoerr-backport-97ea9dd2
$ git checkout TheRealMDoerr-backport-97ea9dd2
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-97ea9dd2
Please sign in to comment.