Hi I have a small project and want to debug a Nashorn Javascript with Intellij 13.1 Ultimate Edition. The break point is shown in the Javascript, but the debugger does not stop at the break point while debugging.
Please find following the java class and the javascript. I am running Intellij 13.1 on Redhat Linux 6 64-Bit with the SDK 1.8.0 64-Bit.
package com.company; import javax.script.ScriptEngine;import javax.script.ScriptEngineManager;import java.io.InputStream;import java.io.InputStreamReader; publicclass ExecuteJavascript { publicstaticvoid main(String[] args) throws Exception { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("nashorn"); if (null == scriptEngine) { thrownew Exception("No Nashorn!"); } InputStream scriptFile = ExecuteJavascript.class.getResourceAsStream("UUIDGenerator.js"); if (null == scriptFile) { thrownew Exception("JavaScript file HelloWorls.js not found"); } scriptEngine.eval(new InputStreamReader(scriptFile)); }}
var requestUuid = null; if (!requestUuid) { var uuid = generateUUID(); print(uuid);}
function generateUUID() { var d = new Date().getTime(); var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = (d + Math.random()*16)%16 | 0; d = Math.floor(d/16); return (c=='x' ? r : (r&0x7|0x8)).toString(16); }); return uuid;};