I dynamically load and run JavaScript code that is stored on disk in the YAML file. I would like to know if it is possible (using intelliJ) to debug JS code even if I do not load it from a standalone JS file. To simplify the description of the problem, consider the following Java code:
NashornScriptEngineFactory nashornFactory = new NashornScriptEngineFactory();
ScriptEngine engine = nashornFactory.getScriptEngine();
engine.eval("var a = 1 + 1;\nprint(a);");
How to set a breakpoint on line 2 (calling the "print" function) and how do I know the value of the variable "a"? If this is not possible, what would be the best way?
source
share