当想要在IDE中调试Java和Javascript时,似乎必须使用load(filename)
Nashorn extension,请参阅Debugging Nashorn JavaScript with IntellijNashorn Javascript使用CompiledScript进行调试?
不幸的是,这禁止使用CompiledScript
,作为上述返回一个ScriptObjectMirror
对象,至少没有compile(filename)
犀牛扩展记录。
这里丢失的CompiledScript
功能之一是例如CompiledScript.eval(ScriptContext context)
。我找不到使用ScriptObjectMirror
实现相同的方法。另外,load(filename)
将立即执行脚本,这可能不是想要的。
也https://github.com/aperto/sourceurl-resourcefilter见一个Maven资源过滤器,它会自动加上'// @ sourceURL ='注释JS源文件。这将导致文件名在Netbeans调试器中显示在Nashorn JS stackframes中,即使没有使用'load()',例如。与'CompiledScript'。 – jfrantzius