Subj : Re: rhino - load external javascript To : jupp4711 From : Igor Bukanov Date : Mon Jul 05 2004 12:33 pm Your code is HTML with some embedded JavaScript, not pure JavaScript sources. To deal with that you need HTML parser that would properly extract JS sources which you can later process with Rhino. You can try http://httpunit.sourceforge.net/ that provides necessary setup. Regards, Igor juppi wrote: > hello, > > can anybody help me with this, i'm completely new with rhino... > > i have some js-code to be displayed in an Java-Application (JEditorPane). > > Can I parse it with rhino? I tried it with the shell, but it didn't work. How can I manage that? Can rhino read external js-sources anyway? > Thanks for helping. > > Here my java-method to run rhino: > > public String evalCommand(String command) { > Scriptable m_jsScope =m_jsContext.initStandardObjects(); > try { > // Evaluate the command > result = m_jsContext.evaluateString(m_jsScope, command, > "", 0, null); > // Convert the result to a string and print it > System.out.println(Context.toString(result)); > } catch (JavaScriptException e) { > System.out.println("Caught exception " + e > + " while trying to evaluate JavaScript command" + command); > e.printStackTrace(); > } > return Context.toString(result); > } > > > Here the js-code to be parsed: > > > > > > > > > > > > > > > > .