Example usage for javax.script ScriptEngineFactory getEngineName

List of usage examples for javax.script ScriptEngineFactory getEngineName

Introduction

In this page you can find the example usage for javax.script ScriptEngineFactory getEngineName.

Prototype

public String getEngineName();

Source Link

Document

Returns the full name of the ScriptEngine.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    ScriptEngineManager mgr = new ScriptEngineManager();
    List<ScriptEngineFactory> engines = mgr.getEngineFactories();
    for (ScriptEngineFactory engine : engines) {
        System.out.println(engine.getEngineName());
        for (String n : engine.getNames()) {
            System.out.println("Short name : " + n);
        }/*  www. j a  v a2s. c  om*/
    }
}

From source file:ListEngineFactoryDemo.java

public static void main(String[] args) {
    // create ScriptEngineManager
    ScriptEngineManager manager = new ScriptEngineManager();
    List<ScriptEngineFactory> factoryList = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factoryList) {
        System.out.println(factory.getEngineName());
        System.out.println(factory.getLanguageName());
    }//from   w  w w  .j ava 2 s.  co m
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    ScriptEngineManager mgr = new ScriptEngineManager();
    List<ScriptEngineFactory> engines = mgr.getEngineFactories();
    for (ScriptEngineFactory engine : engines) {
        System.out.println(engine.getEngineName());
        for (String n : engine.getNames()) {
            System.out.println("Short name : " + n);
        }//  ww w  . j av  a 2s .  c  om
    }
    ScriptEngine engine = mgr.getEngineByName("JavaScript");
    String myJSCode = "function myFunction(){return (4+2);}myFunction();";
    System.out.println(engine.eval(myJSCode));
}

From source file:Main.java

public static void main(String args[]) {
    ScriptEngineManager manager = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        System.out.println(factory.getEngineName());
        System.out.println(factory.getEngineVersion());
        System.out.println(factory.getLanguageName());
        System.out.println(factory.getLanguageVersion());
        System.out.println(factory.getExtensions());
        System.out.println(factory.getMimeTypes());
        System.out.println(factory.getNames());
    }//from  w w w .  jav a 2 s .  c  o m
}

From source file:MetadataDemo.java

public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        System.out.println("Full name = " + factory.getEngineName());
        System.out.println("\nVersion = " + factory.getEngineVersion());
        System.out.println("\nSupported language version = " + factory.getLanguageVersion());
    }/*from  w  w  w  .j a v  a 2s. c om*/
}

From source file:Main.java

public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();

    // Get the list of all available engines
    List<ScriptEngineFactory> list = manager.getEngineFactories();

    // Print the details of each engine
    for (ScriptEngineFactory f : list) {
        System.out.println("Engine Name:" + f.getEngineName());
        System.out.println("Engine Version:" + f.getEngineVersion());
        System.out.println("Language Name:" + f.getLanguageName());
        System.out.println("Language Version:" + f.getLanguageVersion());
        System.out.println("Engine Short Names:" + f.getNames());
        System.out.println("Mime Types:" + f.getMimeTypes());
        System.out.println("===");
    }//from w ww. j  av  a 2  s  .  co  m
}

From source file:Main.java

public static void main(String[] args) {
    ScriptEngineManager mgr = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = mgr.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        System.out.println(String.format("engineName: %s, THREADING: %s", factory.getEngineName(),
                factory.getParameter("THREADING")));
    }//from  www  .  j  a v  a 2s  .  co m
}

From source file:EnumerateScriptEngines.java

public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();

    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        System.out.println("Engine name (full): " + factory.getEngineName());
        System.out.println("Engine version: " + factory.getEngineVersion());
        System.out.println("Supported extensions:");
        List<String> extensions = factory.getExtensions();
        for (String extension : extensions)
            System.out.println("  " + extension);
        System.out.println("Language name: " + factory.getLanguageName());
        System.out.println("Language version: " + factory.getLanguageVersion());
        System.out.println("Supported MIME types:");
        List<String> mimetypes = factory.getMimeTypes();
        for (String mimetype : mimetypes)
            System.out.println("  " + mimetype);
        System.out.println("Supported short names:");
        List<String> shortnames = factory.getNames();
        for (String shortname : shortnames)
            System.out.println("  " + shortname);
        System.out.println();/*from www  .j  a  v a 2s  . c o m*/
    }
}

From source file:com.xafero.vee.cmd.MainApp.java

private static void printLanguages() {
    ScriptEngineManager mgr = new ScriptEngineManager();
    for (ScriptEngineFactory factory : mgr.getEngineFactories())
        System.out.println(MoreObjects.toStringHelper("").add("name", factory.getEngineName())
                .add("version", factory.getEngineVersion())
                .add("extensions", "[ " + Strings.join(" | ", factory.getExtensions()) + " ]")
                .add("mimeTypes", "[ " + Strings.join(" | ", factory.getMimeTypes()) + " ]")
                .add("aliases", "[ " + Strings.join(" | ", factory.getNames()) + " ]")
                .add("language", factory.getLanguageName() + " " + factory.getLanguageVersion())
                .omitNullValues().toString().replace(", ", String.format(", %n ")));
}

From source file:org.mycontroller.standalone.scripts.McScriptEngineUtils.java

public static List<HashMap<String, Object>> getScriptEnginesDetail() {
    List<HashMap<String, Object>> engines = new ArrayList<HashMap<String, Object>>();
    ScriptEngineManager mgr = McScriptEngineUtils.getScriptEngineManager();
    List<ScriptEngineFactory> factories = mgr.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        HashMap<String, Object> engine = new HashMap<String, Object>();
        engine.put("engineName", factory.getEngineName());
        engine.put("engineVersion", factory.getEngineVersion());
        engine.put("languageName", factory.getLanguageName());
        engine.put("languageVersion", factory.getLanguageVersion());
        engine.put("extensions", factory.getExtensions());
        engine.put("alias", factory.getNames());
        engines.add(engine);// w ww  . j a  v  a  2 s.com
    }
    return engines;
}