Class JavaVersion

java.lang.Object
com.google.gson.internal.JavaVersion

public final class JavaVersion extends Object
Utility to check the major Java version of the current JVM.
  • Method Details

    • getMajorJavaVersion

      public static int getMajorJavaVersion()
      Returns:
      the major Java version, i.e. '8' for Java 1.8, '9' for Java 9 etc.
    • isJava9OrLater

      public static boolean isJava9OrLater()
      Returns:
      true if the application is running on Java 9 or later; and false otherwise.