built in – Java ScriptEngine supported languages

built in – Java ScriptEngine supported languages

Here is a script to determine all languages on your system:

import java.util.List;
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngineFactory;

public class Test {

public static void main(String[] args)
    ScriptEngineManager mgr = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = mgr.getEngineFactories();
    for (ScriptEngineFactory factory : factories)
        System.out.println(ScriptEngineFactory Info);
        String engName = factory.getEngineName();
        String engVersion = factory.getEngineVersion();
        String langName = factory.getLanguageName();
        String langVersion = factory.getLanguageVersion();
        System.out.printf(tScript Engine: %s (%s)n, engName, engVersion);
        List<String> engNames = factory.getNames();
        for (String name : engNames)
            System.out.printf(tEngine Alias: %sn, name);
        System.out.printf(tLanguage: %s (%s)n, langName, langVersion);


Hope this helps.

..I know for a fact that JavaScript is supported,..

ECMAscript, technically.

.. but I couldnt find any other languages to work with it.
Is, for example, Ruby implemented?

No. The ECMAscript engine is the only one included by default, the last time I heard.


The comments of Pointy below, suggest that the Nashorn engine has been deprecated and will be removed soon.

built in – Java ScriptEngine supported languages

Not in ScriptEngine, but you can still use BSF. From the Apache Commons Bean Scripting Framework, you can find its Documentation here. –

BSF 2.x supports several scripting languages currently:

In addition, the following languages are supported with their own BSF engines:

Leave a Reply

Your email address will not be published.