1

How can I import a static method from Java class into JS running in Rhino?

I'm using Oracle implementation (e.g. no access to org.mozilla classes), which as far as I'm aware only has access to JSR-223 API (I'm willing to be proven wrong on this assumption :)

As such, the solutions from this answer don't seem to work: How do I call a method of a Java instance from JavaScript?

Community
  • 1
  • 1
DVK
  • 126,886
  • 32
  • 213
  • 327

1 Answers1

-1

Use the Caller-Allowable-Codebase attribute in your manifest. This will allow your applet's functions to be called from JS. To call JS from Java you'll need netscape.javascript.JSObject. I'm not aware of an equivalent to JSObject without netscape classes.

MaKR
  • 1,882
  • 2
  • 17
  • 29
  • Um. Forgive the newbie question, but how do I get a manifest in a desktop-deployed non-applet Java Swing app? – DVK Apr 20 '15 at 18:23
  • I missed that part... I haven't done desktop Java since college, but I'd imagine still in META-INF/MAINFEST.MF – MaKR Apr 20 '15 at 22:03