Example usage for javax.script ScriptEngineManager getEngineFactories

List of usage examples for javax.script ScriptEngineManager getEngineFactories

Introduction

In this page you can find the example usage for javax.script ScriptEngineManager getEngineFactories.

Prototype

public List<ScriptEngineFactory> getEngineFactories() 

Source Link

Document

Returns a list whose elements are instances of all the ScriptEngineFactory classes found by the discovery mechanism.

Usage

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")));
    }//w  w w. j  a v  a2  s . c  o  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);
        }//  www .j  ava  2 s . co m
    }
}

From source file:ThreadingBehavior.java

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

    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories)
        System.out.println("Threading behavior: " + factory.getParameter("THREADING"));
}

From source file:MimeTypesDemo.java

public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        List<String> mimeTypes = factory.getMimeTypes();
        for (int i = 0; i < mimeTypes.size(); i++) {
            System.out.printf("Supported MIME type " + i + " " + (String) mimeTypes.get(i) + "\n");
        }/*from ww w .  j a  v  a  2s.  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 www  .  j  av  a2 s.co m
}

From source file:RegisteredNameDemo.java

public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        List<String> regNames = factory.getNames();
        for (int i = 0; i < regNames.size(); i++) {
            System.out.printf("Registered name " + i + " " + (String) regNames.get(i) + "\n");
        }/*from   w ww  . j  av a  2  s. co  m*/
    }
}

From source file:FileExtensionsDemo.java

public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = manager.getEngineFactories();
    for (ScriptEngineFactory factory : factories) {
        List<String> ext = factory.getExtensions();
        for (int i = 0; i < ext.size(); i++) {
            System.out.printf("Supported file extension: " + (String) ext.get(i) + "\n");
        }/*w  ww.jav  a  2s  .  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);
        }/* w w  w.j a v  a2 s  .c o m*/
    }
    ScriptEngine engine = mgr.getEngineByName("JavaScript");
    String myJSCode = "function myFunction(){return (4+2);}myFunction();";
    System.out.println(engine.eval(myJSCode));
}

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  av a  2  s  .  c  o m
}

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.j  av  a 2 s. c o  m*/
}