Created
November 9, 2013 02:41
-
-
Save yusuke/7380903 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package daemon; | |
| import javax.script.ScriptEngine; | |
| import javax.script.ScriptEngineFactory; | |
| import javax.script.ScriptEngineManager; | |
| import javax.script.ScriptException; | |
| public class Foo { | |
| public static void main(String... args) throws ScriptException { | |
| ScriptEngineManager manager = new ScriptEngineManager(); | |
| for(ScriptEngineFactory factory : manager.getEngineFactories()) { | |
| System.out.println(factory); | |
| System.out.println(" getEngineName: "+factory.getEngineName()); | |
| System.out.println(" getEngineVersion: "+factory.getEngineVersion()); | |
| System.out.println(" getLanguageName: "+factory.getLanguageName()); | |
| System.out.println(" getLanguageVersion: "+factory.getLanguageVersion()); | |
| System.out.println(" getExtensions: "+factory.getExtensions()); | |
| System.out.println(" getMimeTypes: "+factory.getMimeTypes()); | |
| System.out.println(" getNames: "+factory.getNames()); | |
| System.out.println(" getScriptEngine: "+factory.getScriptEngine()); | |
| } | |
| ScriptEngine engine = manager.getEngineByName("js"); | |
| engine.eval("print('Hello, World!');"); } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apple.applescript.AppleScriptEngineFactory@5f205aa | |
| getEngineName: AppleScriptEngine | |
| getEngineVersion: 1.1 | |
| getLanguageName: AppleScript | |
| getLanguageVersion: 2.3 | |
| getExtensions: [scpt, applescript, app] | |
| getMimeTypes: [application/x-applescript, text/plain, text/applescript] | |
| getNames: [AppleScriptEngine, AppleScript, OSA] | |
| getScriptEngine: apple.applescript.AppleScriptEngine@7bb11784 | |
| jdk.nashorn.api.scripting.NashornScriptEngineFactory@277c0f21 | |
| getEngineName: Oracle Nashorn | |
| getEngineVersion: 1.8.0 | |
| getLanguageName: ECMAScript | |
| getLanguageVersion: ECMA - 262 Edition 5.1 | |
| getExtensions: [js] | |
| getMimeTypes: [application/javascript, application/ecmascript, text/javascript, text/ecmascript] | |
| getNames: [nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript] | |
| getScriptEngine: jdk.nashorn.api.scripting.NashornScriptEngine@24aed80c | |
| Hello, World! | |
| Disconnected from the target VM, address: '127.0.0.1:50090', transport: 'socket' | |
| Process finished with exit code 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment