Search code examples
javajavascripteclipserhino

Debug javascript used in a Java application


I work on a java standalone project that use rhino to run javascript. Those scripts are mainly objects manipulation.

Using logger in the javascript is not always enough so i would like to use something like the java debugger in eclipse.

I can't find a way to debug the javascript files in Eclipse: even if I put breakpoint in my files, the scripts execution is never suspended.

I run Eclipse Kepler and have the Javascript Development Tools plugin.

Is there any simple way to do that?


Solution

  • Rhino has a visual debugger built in (org.mozilla.javascript.tools.debugger.Main) which you can use to debug embedded scripts.

    You can also use Eclipse to debug embedded Rhino using the org.eclipse.wst.jsdt.debug.rhino.debugger and org.eclipse.wst.jsdt.debug.transport plugins in Juno (presumably this works in later versions too.)