public static boolean isJavaVersionOK ( ) { boolean isJavaVersionOK = true ; String versionStr = System . getProperty ( "java.version" ) ; String [ ] parts ; double version ; if ( versionStr . contains ( "." ) ) { parts = versionStr . split ( "\\." ) ; } else { parts = new String [ ] { versionStr } ; } if ( parts . length == 1 ) { try { version = Double . parseDouble ( parts [ 0 ] ) ; } catch ( Exception e ) { System . err . println ( "Unparsable Java version: " + versionStr ) ; return false ; } } else { try { version = Double . parseDouble ( parts [ 0 ] ) + Double . parseDouble ( parts [ 1 ] ) / 10 ; } catch ( Exception e ) { System . err . println ( "Unparsable Java version: " + versionStr ) ; return false ; } } if ( version < 1.8 ) { isJavaVersionOK = false ; System . err . println ( ) ; System . err . println ( Globals . getWorkbenchInfoString ( ) ) ; System . err . println ( ) ; System . err . print ( "Java 8 or higher is required to run MOA. " ) ; System . err . println ( "Java version " + versionStr + " found" ) ; } return isJavaVersionOK ; }
Checks if the Java version is recent enough to run MOA .