Top Description Constructors Methods
com.sun.jna.platform.win32

public Class VersionHelpers

extends Object
Class Inheritance
Imports
com.sun.jna.platform.win32.WinDef.DWORD, .WinDef.WORD, .WinNT.OSVERSIONINFOEX

The following functions can be used to determine the current operating system version or identify whether it is a Windows or Windows Server release. These functions provide simple tests that use the VerifyVersionInfo function and the recommended greater than or equal to comparisons that are proven as a robust means to determine the operating system version.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows 10 version. For Windows 10, IsWindows8Point1OrGreater returns false unless the application contains a manifest that includes a compatibility section that contains the GUID that designates Windows 10.
IsWindows10OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows 7 version.
IsWindows7OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows 7 with Service Pack 1 (SP1) version.
IsWindows7SP1OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows 8 version.
IsWindows8OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows 8.1 version. For Windows 8.1 and/or Windows 10, IsWindows8Point1OrGreater returns false unless the application contains a manifest that includes a compatibility section that contains the GUIDs that designate Windows 8.1 and/or Windows 10.
IsWindows8Point1OrGreater
()

public static boolean

Returns:

true if the current OS is a Windows Server release.
IsWindowsServer
()

Applications that need to distinguish between server and client versions of Windows should call this function.

public static boolean

Returns:

True if the current OS version matches, or is greater than, the provided version information.
IsWindowsVersionOrGreater
(int
The major version to test
wMajorVersion
,
int
The minor version to test
wMinorVersion
,
int
The service pack to test
wServicePackMajor
)

This function is useful in confirming a version of Windows Server that doesn't share a version number with a client release.

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows Vista version.
IsWindowsVistaOrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows Vista with Service Pack 1 (SP1) version.
IsWindowsVistaSP1OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows Vista with Service Pack 2 (SP2) version.
IsWindowsVistaSP2OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows XP version.
IsWindowsXPOrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows XP with Service Pack 1 (SP1) version.
IsWindowsXPSP1OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows XP with Service Pack 2 (SP2) version.
IsWindowsXPSP2OrGreater
()

public static boolean

Returns:

true if the current OS version matches, or is greater than, the Windows XP with Service Pack 3 (SP3) version.
IsWindowsXPSP3OrGreater
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

VersionHelpersback to summary
public VersionHelpers()

Method Detail

IsWindows10OrGreaterback to summary
public static boolean IsWindows10OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows 10 version. For Windows 10, IsWindows8Point1OrGreater returns false unless the application contains a manifest that includes a compatibility section that contains the GUID that designates Windows 10.

IsWindows7OrGreaterback to summary
public static boolean IsWindows7OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows 7 version.

IsWindows7SP1OrGreaterback to summary
public static boolean IsWindows7SP1OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows 7 with Service Pack 1 (SP1) version.

IsWindows8OrGreaterback to summary
public static boolean IsWindows8OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows 8 version.

IsWindows8Point1OrGreaterback to summary
public static boolean IsWindows8Point1OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows 8.1 version. For Windows 8.1 and/or Windows 10, IsWindows8Point1OrGreater returns false unless the application contains a manifest that includes a compatibility section that contains the GUIDs that designate Windows 8.1 and/or Windows 10.

IsWindowsServerback to summary
public static boolean IsWindowsServer()

Applications that need to distinguish between server and client versions of Windows should call this function.

Returns:boolean

true if the current OS is a Windows Server release.

IsWindowsVersionOrGreaterback to summary
public static boolean IsWindowsVersionOrGreater(int wMajorVersion, int wMinorVersion, int wServicePackMajor)

This function is useful in confirming a version of Windows Server that doesn't share a version number with a client release. You should only use this function if the other provided version helper functions do not fit your scenario.

Parameters
wMajorVersion:int

The major version to test

wMinorVersion:int

The minor version to test

wServicePackMajor:int

The service pack to test

Returns:boolean

True if the current OS version matches, or is greater than, the provided version information.

IsWindowsVistaOrGreaterback to summary
public static boolean IsWindowsVistaOrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows Vista version.

IsWindowsVistaSP1OrGreaterback to summary
public static boolean IsWindowsVistaSP1OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows Vista with Service Pack 1 (SP1) version.

IsWindowsVistaSP2OrGreaterback to summary
public static boolean IsWindowsVistaSP2OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows Vista with Service Pack 2 (SP2) version.

IsWindowsXPOrGreaterback to summary
public static boolean IsWindowsXPOrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows XP version.

IsWindowsXPSP1OrGreaterback to summary
public static boolean IsWindowsXPSP1OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows XP with Service Pack 1 (SP1) version.

IsWindowsXPSP2OrGreaterback to summary
public static boolean IsWindowsXPSP2OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows XP with Service Pack 2 (SP2) version.

IsWindowsXPSP3OrGreaterback to summary
public static boolean IsWindowsXPSP3OrGreater()
Returns:boolean

true if the current OS version matches, or is greater than, the Windows XP with Service Pack 3 (SP3) version.