Unable to view variable value from IDEA using Nashorn engine

48 views Asked by At

I am unable to see the variable value from the debug window in IDEA (2023) when I try to debug some JS code. The only thing shown is the message 'Collecting data...' and the Evaluate expression is pretty much useless.

My current working environment is as follows:

  • My Java code is under src/main/java.
  • My JavaScript code is under src/resources/engine. Each file contains only one function with the name equal to the filename. My Java code reads the JS files, adds some fixed code (Java imports) to the top, and runs it with eval().

Is there any way to see those variable values? I am okay even without IDEA.

I am able to step through the code (only after a Maven clean install) using the following notation on top of the JS file: //@ sourceURL=<path to JS code>.

I have already tried the debugger; way, but it seems useless.

0

There are 0 answers