public static boolean isJavaxScriptingAvailable() {
    Object engine = null;
    try {
      Class<?> managerClass = Class.forName("javax.script.ScriptEngineManager");
      Method m = managerClass.getMethod("getEngineByMimeType", String.class);
      engine = m.invoke(managerClass.newInstance(), "text/javascript");
    } catch (ClassNotFoundException | NoSuchMethodException
        | IllegalAccessException | InvocationTargetException
        | InstantiationException e) {
      return false;
    }

    return engine != null;
  }
public static boolean isJavaxScriptingAvailable() {
    Object engine = null;
    try {
      Class<?> managerClass = Class.forName("javax.script.ScriptEngineManager");
      Method m = managerClass.getMethod("getEngineByMimeType", String.class);
      engine = m.invoke(managerClass.newInstance(), "text/javascript");
    } catch (ClassNotFoundException | NoSuchMethodException
        | IllegalAccessException | InvocationTargetException
        | InstantiationException e) {
      return false;
    }

    return engine != null;
  }
public static boolean isJavaxScriptingAvailable ( ) { Object engine = null ; try { Class < ? > managerClass = Class . forName ( "javax.script.ScriptEngineManager" ) ; Method m = managerClass . getMethod ( "getEngineByMimeType" , String . class ) ; engine = m . invoke ( managerClass . newInstance ( ) , "text/javascript" ) ; } catch ( ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e ) { return false ; } return engine != null ; }
***********************************************************************
Checks whether javax.script is available or not. Completely done per
Reflection to allow compilation under Java 1.5

@return true if javax.script is available; false otherwise
**********************************************************************
*********************************************************************** Checks whether javax . script is available or not . Completely done per Reflection to allow compilation under Java 1 . 5