private static boolean isJDK_N_OrHigher ( int n ) { List < String > versionList = new ArrayList < String > ( ) ; // this code should work at least until JDK 10 (assuming n parameter is // always 6 or more) for ( int i = 0 ; i < 5 ; i ++ ) { //Till JDK 1.8 versioning is 1.x after 10 its will JDK N.x if ( n + i < 10 ) versionList . add ( "1." + ( n + i ) ) ; else versionList . add ( ( n + i ) + "." ) ; } String javaVersion = System . getProperty ( "java.version" ) ; if ( javaVersion == null ) { return false ; } for ( String v : versionList ) { if ( javaVersion . startsWith ( v ) ) return true ; } return false ; }
Checks if is jD k_ n_ or higher .