A question about Nashorn and Netbeans debugger

Jim Laskey (Oracle) james.laskey at oracle.com
Tue Nov 24 16:30:54 UTC 2015


Dian,

We’ll dive in for you, but the debugger expert (Sunder) will be signing off soon.  He’ll pick it up tomorrow.

Cheers,

- Jim



> On Nov 24, 2015, at 12:03 PM, Dina Farbman <dina.farbman at new-proimage.com> wrote:
> 
> 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