1

I would like to call on an own Java-method from a JavaScript-file via the ScriptEngineManager provided in Java 1.6. Is that possible?

1 Answer 1

1

Yes: http://www.mozilla.org/rhino/ScriptingJava.html

There are many ways of doing it. The Java code can push references to Java objects into the global context, which will look kind-of like what DOM objects look like to browser Javascript. Or Javascript can instantiate Java objects and reference them.

Sign up to request clarification or add additional context in comments.

2 Comments

How exactly do I use Rhino with ScriptEngineManager? Isn't Rhink a third-party library, right?
Rhino is the Javascript interpreter shipped with JDK 1.6.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.