Disclaimer - this has partially been answered here: How to debug JavaScript in Nashhorn (JDK 8+) in Netbeans?
However I'm having an weird issue with it and I can't add comments to the original question's answer.
So I can use the same code as in original question's answer:
try {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("nashorn");
engine.eval("load(\"" + "src/packageName/file.js" + "\");");
} catch (Exception ex) {
Logger.getLogger(SampleRunner.class.getName()).log(Level.SEVERE, null, ex);
}
It works without any problem and I can debug in NetBeans BUT only when the project is a regular Java app? If I try above debugging (in JS file or any other using javax.script (JSR 223) API in the maven project then it doesn't break. Any ideas? Is the debugging of javax.script unavailable in maven projects in NetBeans?