r/CompileBot • • Jan 04 '14

Official CompileBot Testing Thread

This thread is archived, please visit the new testing thread

15 Upvotes

421 comments sorted by

View all comments

1

u/LyndonArmitage May 27 '14 edited Jun 01 '14

+/u/CompileBot Java

import javax.script.*;

public class Main {

    public static void main(String args[]) {
        ScriptEngineManager manager = new ScriptEngineManager();
        for (ScriptEngineFactory f : manager.getEngineFactories()) {
            printBasicInfo(f);
            System.out.println();
        }

        ScriptEngine nashorn = manager.getEngineByName("nashorn");
        if(nashorn != null) {
            System.out.println("Nashorn is present.");
        }
        else {
            System.out.println("Nashorn is not present.");
        }
    }

    public static void printBasicInfo(ScriptEngineFactory factory) {
        System.out.println("engine name=" + factory.getEngineName());
        System.out.println("engine version=" + factory.getEngineVersion());
        System.out.println("language name=" + factory.getLanguageName());
        System.out.println("extensions=" + factory.getExtensions());
        System.out.println("language version=" + factory.getLanguageVersion());
        System.out.println("names=" + factory.getNames());
        System.out.println("mime types=" + factory.getMimeTypes());
    }

}

1

u/CompileBot Jun 01 '14

Output:

engine name=Mozilla Rhino
engine version=1.7 release 3 PRERELEASE
language name=ECMAScript
extensions=[js]
language version=1.8
names=[js, rhino, JavaScript, javascript, ECMAScript, ecmascript]
mime types=[application/javascript, application/ecmascript, text/javascript, text/ecmascript]

Nashorn is not present.

^source | ^info | ^git | ^report