SrLin
SrLin

Reputation: 1

Why is engine is null or I need to download library

import javax.script.*;

public class Triangle {
    public static void main(String[] args) throws Exception {
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByName("javascript"); 
        Object result = engine.eval("20+3");
        System.out.println(result);
    }
}

I get an exception that engine is null, why?

Upvotes: 0

Views: 29

Answers (0)

Related Questions