public static boolean isJavaVersionAtLeast(String expectedVersion){
  String actualVersionDigits;
  if (isAzulJVM()) {
    actualVersionDigits=StringUtils.getDigitsOnly(System.getProperty("java.specification.version"));
    int dotIdx=expectedVersion.indexOf('.');
    if (dotIdx != -1) {
      dotIdx=expectedVersion.indexOf('.',dotIdx + 1);
      if (dotIdx != -1) {
        expectedVersion=expectedVersion.substring(0,dotIdx);
      }
    }
  }
 else {
    actualVersionDigits=StringUtils.getDigitsOnly(System.getProperty("java.version"));
  }
  String expectedVersionDigits=StringUtils.padEnding(StringUtils.getDigitsOnly(expectedVersion),'0',actualVersionDigits.length());
  try {
    return (Long.parseLong(actualVersionDigits) >= Long.parseLong(expectedVersionDigits));
  }
 catch (  NumberFormatException ignore) {
    return false;
  }
}

public static boolean isJavaVersionAtLeast ( String expectedVersion ) { String actualVersionDigits ; if ( isAzulJVM ( ) ) { actualVersionDigits = StringUtils . getDigitsOnly ( System . getProperty ( "java.specification.version" ) ) ; int dotIdx = expectedVersion . indexOf ( '.' ) ; if ( dotIdx != - 1 ) { dotIdx = expectedVersion . indexOf ( '.' , dotIdx + 1 ) ; if ( dotIdx != - 1 ) { expectedVersion = expectedVersion . substring ( 0 , dotIdx ) ; } } } else { actualVersionDigits = StringUtils . getDigitsOnly ( System . getProperty ( "java.version" ) ) ; } String expectedVersionDigits = StringUtils . padEnding ( StringUtils . getDigitsOnly ( expectedVersion ) , '0' , actualVersionDigits . length ( ) ) ; try { return ( Long . parseLong ( actualVersionDigits ) >= Long . parseLong ( expectedVersionDigits ) ) ; } catch ( NumberFormatException ignore ) { return false ; } }
utility method to determine whether the installed java runtime environment ( jre ) is minimally at the specified , expected version . typically , java versions are of the form " 1 . 6 . 0_31 " . . . in the azul jvm java . version does not have the " _nn " suffix . instead it has the azul product version as the suffix like so " - zing_nn . nn . n . n " . so on azul we instead use the " java . specification . version " sys prop and only compare the major and minor version numbers . all the stuff after the second " . " in expectedversion is ignored .
