Hello everyone,
In my code, I have a bunch of scripts contained in .js files. Whenever one of the scripts contains an error, I get this:
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "nonexistant" is not defined. (<Unknown source>#5) in <Unknown source> at line number 5
What bugs me is the <Unknown Source>. Multiple files are in one ScriptContext, and it can be hard to track down an error. It also looks horrible.
Is there a way to replace <Unknown Source> with the actual file name? None of the methods I see support passing a File object, so I'm really confused here.
Mirrored at Replace <Unknown Source> in Java Rhino (JSR223) with actual file name - Stack Overflow


LinkBack URL
About LinkBacks
Reply With Quote

I wasn't suggesting it was a compiler error, I was just saying that in order to get the filename and line number of Java source in exception messages, the javac -g debug options should be used when compiling Java source code. Clearly this will only tell you the last Java class file and line executed, not JavaScript innards, but I thought this was a Java question. If it doesn't apply here, then I'm sorry, it won't help
