Hi all,
I' ve 2 js files as follow:
exec.js
print (somma(3,4))
java.lang.System.out.println("hi, mom!");
stringUtil.js
function somma(a,b)
{
var totale=a+b;
return totale;
}
If I use the shell as follow:
java -jar js.jar -f ZZZ\stringUtil.js ZZZ\exec.js
all runs OK and obtain
7
hi, mom!
If I generate the correspondly .class file using
java -classpath js.jar org.mozilla.javascript.tools.jsc.Main ZZZ\*.js
and try to run:
java -classpath "..\js.jar;." exec
I get the following error:
C:\Lavori\zrt\rhino1_6R7\ZZZ>java -classpath "..\js.jar;." exec
Exception in thread "main" org.mozilla.javascript.EcmaError: ReferenceError:
"somma"
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:33
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:33
at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:341
at
org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime
at
org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
at exec._c0(Unknown Source)
at exec.call(Unknown Source)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at exec.call(Unknown Source)
at exec.exec(Unknown Source)
at
org.mozilla.javascript.optimizer.OptRuntime$1.run(OptRuntime.java:252)
at org.mozilla.javascript.Context.call(Context.java:577)
at org.mozilla.javascript.Context.call(Context.java:499)
at org.mozilla.javascript.optimizer.OptRuntime.main(OptRuntime.java:240)
at exec.main(Unknown Source)
How can I resolve this error ??? Where I make a mistake ???
Thanks in advance.
Alex
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino