Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
268 views
in Technique[技术] by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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("Script Engine: %s (%s)%n", engName, engVersion);

            List<String> engNames = factory.getNames();
            for(String name : engNames) {
                System.out.printf("Engine Alias: %s%n", name);
            }

            System.out.printf("Language: %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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...