The problem is that loading "exec" doesn't force loading "stringUtil".
Try using the shell to explicitly load the classes:
[rhino] cat ZZZ/stringUtil.js
function somma(a,b)
{
var totale=a+b;
return totale;
}
[rhino] cat ZZZ/exec.js
print (somma(3,4))
java.lang.System.out.println("hi, mom!");
[rhino] java -classpath build/rhino1_7R1pre/js.jar
org.mozilla.javascript.tools.jsc.Main ZZZ/*.js
[rhino] java -classpath build/rhino1_7R1pre/js.jar:.
org.mozilla.javascript.tools.shell.Main -f ZZZ/stringUtil.class -f ZZZ/
exec.class
7
hi, mom!
[rhino]
--N
Thank you Norris,
in this way all runs.
I thougth to be able to run the compiled class outside the shell.
Probably this runs only for js not linked one to another. "What a
pity !!!" .... it was better not use directly the shell to run my app
Bye
Yes, the issue is the one piece of JavaScript depending on another.
Given JavaScript's dynamic nature we didn't want to compile in
explicit dependencies into the generated class files.
The shell is not strictly required; if you create a scope and then
load the generated classes as org.mozilla.javascript.Script instances
and then call their exec() methods in turn on the same scope you
should get the behavior you desire.
--N