Skip to content

Commit c2e015c

Browse files
committedSep 2, 2021
8273229: Update OS detection code to recognize Windows Server 2022
Reviewed-by: alanb, dholmes
1 parent 0c1b16b commit c2e015c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed
 

‎src/hotspot/os/windows/os_windows.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -1866,9 +1866,13 @@ void os::win32::print_windows_version(outputStream* st) {
18661866
if (is_workstation) {
18671867
st->print("10");
18681868
} else {
1869-
// distinguish Windows Server 2016 and 2019 by build number
1870-
// Windows server 2019 GA 10/2018 build number is 17763
1871-
if (build_number > 17762) {
1869+
// distinguish Windows Server by build number
1870+
// - 2016 GA 10/2016 build: 14393
1871+
// - 2019 GA 11/2018 build: 17763
1872+
// - 2022 GA 08/2021 build: 20348
1873+
if (build_number > 20347) {
1874+
st->print("Server 2022");
1875+
} else if (build_number > 17762) {
18721876
st->print("Server 2019");
18731877
} else {
18741878
st->print("Server 2016");

‎src/java.base/windows/native/libjava/java_props_md.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ GetJavaProperties(JNIEnv* env)
389389
GetVersionEx((OSVERSIONINFO *) &ver);
390390
majorVersion = ver.dwMajorVersion;
391391
minorVersion = ver.dwMinorVersion;
392-
/* distinguish Windows Server 2016 and 2019 by build number */
392+
/* distinguish Windows Server 2016+ by build number */
393393
buildNumber = ver.dwBuildNumber;
394394
is_workstation = (ver.wProductType == VER_NT_WORKSTATION);
395395
platformId = ver.dwPlatformId;
@@ -474,6 +474,8 @@ GetJavaProperties(JNIEnv* env)
474474
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
475475
* Windows Server 2019 10 0 (!VER_NT_WORKSTATION)
476476
* where (buildNumber > 17762)
477+
* Windows Server 2022 10 0 (!VER_NT_WORKSTATION)
478+
* where (buildNumber > 20347)
477479
*
478480
* This mapping will presumably be augmented as new Windows
479481
* versions are released.
@@ -549,7 +551,10 @@ GetJavaProperties(JNIEnv* env)
549551
switch (minorVersion) {
550552
case 0:
551553
/* Windows server 2019 GA 10/2018 build number is 17763 */
552-
if (buildNumber > 17762) {
554+
/* Windows server 2022 build number is 20348 */
555+
if (buildNumber > 20347) {
556+
sprops.os_name = "Windows Server 2022";
557+
} else if (buildNumber > 17676) {
553558
sprops.os_name = "Windows Server 2019";
554559
} else {
555560
sprops.os_name = "Windows Server 2016";

0 commit comments

Comments
 (0)
Please sign in to comment.