Subj : Re: Rhino Outputting To : Ronald Kent Gibson From : Igor Bukanov Date : Thu Mar 04 2004 03:36 pm Ronald Kent Gibson wrote: > Dear All, > > Are there any commands supported in rhino where the javascript can output > the value of a variable?. > > Maybe I am just too much of a newbie and some concept is missing, however > this is what I want to do, I want to compile a javascript program into java > and I want the javascript program to output some values, for example: > > x = 1; > y = 2; > z = x + y; > document.write(z); > > or > > x = 1; > y = 2; > z = x + y; > alert(z); > > both compile ok but I get runtime errors: document and alert are DOM object and function which should be provided by Rhino embedding. For compiled scripts Rhino exposes Rhino shell environment so you can use all Predefined properties listed at http://www.mozilla.org/rhino/shell.html like print function: print(z) Regards, Igor .