Class JvmUtil

java.lang.Object
org.codelibs.fess.util.JvmUtil

public final class JvmUtil extends Object
Utility class for JVM-related operations. This class provides methods for handling JVM options and version detection.
  • Method Details

    • filterJvmOptions

      public static String[] filterJvmOptions(String[] values)
      Filters JVM options based on the current Java version. Options can be prefixed with version numbers to specify compatibility. Format: "version:option" or "version-:option" (for version and above).
      Parameters:
      values - the array of JVM options to filter
      Returns:
      the filtered array of JVM options applicable to the current Java version
    • getJavaVersion

      public static int getJavaVersion()
      Gets the major version number of the current Java runtime. For Java 8 and below, returns the minor version (e.g., 8 for Java 1.8). For Java 9 and above, returns the major version (e.g., 11 for Java 11).
      Returns:
      the Java version number, defaults to 8 if version cannot be determined