A code is worth 1000 words of explaining it :-) package jasim; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager;
Any ideas? public clas开发者_JS百科s Main { public static void main(String[] args) throws ScriptException {
I use Java\'s ScriptEngine to execute JavaScript Code. I use the Invocable Interface, so that I can use the Script Code as a normal Java Object implementing a Java Interface.
Since Java 1.6 there is this nice Script Engine Manager which let\'s i.e. execute JavaScript scripts in run time. Is there something similar in f开发者_开发知识库unctionality in Java 1.5?The Jakarta B