public abstract class JavaEnvironment extends Object
Note that Shiro does not support 1.2 or earlier JVMs - only 1.3 and later.
This class was borrowed and heavily based upon a nearly identical version found in the Spring Framework, with minor modifications. The original author names and copyright (Apache 2.0) has been left in place. A special thanks to Rod Johnson, Juergen Hoeller, and Rick Evans for making this available.
Modifier and Type | Field and Description |
---|---|
static int |
JAVA_13
Constant identifying the 1.3.x JVM (JDK 1.3).
|
static int |
JAVA_14
Constant identifying the 1.4.x JVM (J2SE 1.4).
|
static int |
JAVA_15
Constant identifying the 1.5 JVM (Java 5).
|
static int |
JAVA_16
Constant identifying the 1.6 JVM (Java 6).
|
static int |
JAVA_17
Constant identifying the 1.7 JVM.
|
static int |
JAVA_18
Constant identifying the 1.8 JVM.
|
Constructor and Description |
---|
JavaEnvironment() |
Modifier and Type | Method and Description |
---|---|
static int |
getMajorVersion()
Get the major version code.
|
static String |
getVersion()
Return the full Java version string, as returned by
System.getProperty("java.version") . |
static boolean |
isAtLeastVersion14()
Convenience method to determine if the current JVM is at least Java 1.4.
|
static boolean |
isAtLeastVersion15()
Convenience method to determine if the current JVM is at least
Java 1.5 (Java 5).
|
static boolean |
isAtLeastVersion16()
Convenience method to determine if the current JVM is at least
Java 1.6 (Java 6).
|
public static final int JAVA_13
public static final int JAVA_14
public static final int JAVA_15
public static final int JAVA_16
public static final int JAVA_17
public static final int JAVA_18
public JavaEnvironment()
public static String getVersion()
System.getProperty("java.version")
.System.getProperty(String)
public static int getMajorVersion()
if (getMajorVersion() < JAVA_14)
.public static boolean isAtLeastVersion14()
public static boolean isAtLeastVersion15()
true
if the current JVM is at least Java 1.5getMajorVersion()
,
JAVA_15
,
JAVA_16
,
JAVA_17
,
JAVA_18
public static boolean isAtLeastVersion16()
true
if the current JVM is at least Java 1.6getMajorVersion()
,
JAVA_15
,
JAVA_16
,
JAVA_17
,
JAVA_18
Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.