Where can I find a list of available JSR-223 scripting languages?

HDave picture HDave · Aug 7, 2012 · Viewed 29.9k times · Source

I need a JVM-based scripting language for my app and would like to see what else is out there besides Groovy, Ruby, and Python.

Google keeps pointing me to a dead page at http://scripting.dev.java.net/

Answer

davidbuzatto picture davidbuzatto · Aug 7, 2012

This is not a official list, but you can start here: http://en.wikipedia.org/wiki/List_of_JVM_languages

Rhino (JavaScript) is implemented in the Oracle JDK/JRE by default.

With this code you can see what scripting languages are available in your JDK:

import java.util.*;
import javax.script.*;

public class A {

    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: %s%n", name);
            }

            System.out.printf("\tLanguage: %s (%s)%n", langName, langVersion);

        }

    }

}

This example was obtained here: http://www.oracle.com/technetwork/articles/javase/scripting-140262.html

You may want to try Lua too. Take a look here: how can I embed lua in java?