A question about Nashorn and Netbeans debugger

Dina Farbman dina.farbman at new-proimage.com
Tue Nov 24 16:03:33 UTC 2015


Hi nashorn-dev,
I'm relatively new to Nashorn.
I work on a java 8 application that needs to run server side javascript scripts using Nashorn. The java code runs the scripts at certain points using nashorn's eval function, like this:

SimpleBindings simpleBinding= new SimpleBindings();
              simpleBinding.put(....);
...
ScriptEngineManager factory = new ScriptEngineManager();
            engine = factory.getEngineByName("nashorn");
engine.eval("load('"+scriptpath+"');", simpleBinding);

In addition, I need to provide a way to debug those scripts.
The only option I could find was using Netbeans debugger (remote attach).
The scripts work fine.
The debugger, though, fails to stop at the breakpoints inside the scripts in the following scenario:
1-        Server started
2-        The script is running once
3-        Open Netbeans, attach remote debugger
4-        Run script again

It will stop at the breakpoints inside the scripts in the following scenario:
1-        Server started
2-        Open Netbeans, attach remote debugger
3-        Run the script

So, what am I doing wrong?
What can cause such behavior?
Is there a reasonable workaround?

Thanks in advance,
Dina


More information about the nashorn-dev mailing list