Package com.sun.jna.platform.win32
Class VersionHelpers
- java.lang.Object
-
- com.sun.jna.platform.win32.VersionHelpers
-
public class VersionHelpers extends Object
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
Constructors Constructor Description VersionHelpers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
IsWindows10OrGreater()
static boolean
IsWindows7OrGreater()
static boolean
IsWindows7SP1OrGreater()
static boolean
IsWindows8OrGreater()
static boolean
IsWindows8Point1OrGreater()
static boolean
IsWindowsServer()
Applications that need to distinguish between server and client versions of Windows should call this function.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.static boolean
IsWindowsVistaOrGreater()
static boolean
IsWindowsVistaSP1OrGreater()
static boolean
IsWindowsVistaSP2OrGreater()
static boolean
IsWindowsXPOrGreater()
static boolean
IsWindowsXPSP1OrGreater()
static boolean
IsWindowsXPSP2OrGreater()
static boolean
IsWindowsXPSP3OrGreater()
-
-
-
Method Detail
-
IsWindowsVersionOrGreater
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
- The major version to testwMinorVersion
- The minor version to testwServicePackMajor
- The service pack to test- Returns:
- True if the current OS version matches, or is greater than, the provided version information.
-
IsWindowsXPOrGreater
public static boolean IsWindowsXPOrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows XP version.
-
IsWindowsXPSP1OrGreater
public static boolean IsWindowsXPSP1OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows XP with Service Pack 1 (SP1) version.
-
IsWindowsXPSP2OrGreater
public static boolean IsWindowsXPSP2OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows XP with Service Pack 2 (SP2) version.
-
IsWindowsXPSP3OrGreater
public static boolean IsWindowsXPSP3OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows XP with Service Pack 3 (SP3) version.
-
IsWindowsVistaOrGreater
public static boolean IsWindowsVistaOrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows Vista version.
-
IsWindowsVistaSP1OrGreater
public static boolean IsWindowsVistaSP1OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows Vista with Service Pack 1 (SP1) version.
-
IsWindowsVistaSP2OrGreater
public static boolean IsWindowsVistaSP2OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows Vista with Service Pack 2 (SP2) version.
-
IsWindows7OrGreater
public static boolean IsWindows7OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows 7 version.
-
IsWindows7SP1OrGreater
public static boolean IsWindows7SP1OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows 7 with Service Pack 1 (SP1) version.
-
IsWindows8OrGreater
public static boolean IsWindows8OrGreater()
- Returns:
- true if the current OS version matches, or is greater than, the Windows 8 version.
-
IsWindows8Point1OrGreater
public static boolean IsWindows8Point1OrGreater()
- 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.
-
IsWindows10OrGreater
public static boolean IsWindows10OrGreater()
- 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.
-
IsWindowsServer
public static boolean IsWindowsServer()
Applications that need to distinguish between server and client versions of Windows should call this function.- Returns:
- true if the current OS is a Windows Server release.
-
-