On Jan 30, 5:11 pm, Jon <[EMAIL PROTECTED]> wrote:
> Norris Boyd wrote:
> > On Jan 30, 6:52 am, Jon <[EMAIL PROTECTED]> wrote:
> >> So I've got this xpath parsing rhino javascript file that more or less
> >> functions like the greasemonkey scripts that can parse HTML and perform
> >> xpath queries on it.
>
> >> My difficulty lies in how to generate a java class file correctly.
>
> >> For example my parser is called test.js.
>
> >> I perform
> >> // To run test:
> >> java -cp tagsoup-1.1.3.jar:jdom.jar:jaxen-1.1.1.jar:js.jar
> >> org.mozilla.javascript.tools.shell.Main test.js
>
> >> // To Compile:
> >> java -cp tagsoup-1.1.3.jar:jdom.jar:jaxen-1.1.1.jar:js.jar
> >> org.mozilla.javascript.tools.jsc.Main test.js
>
> >> It outputs test.class. However, I can't seem to run the test class file
> >> correctly. I've tried:
>
> >> java -cp tagsoup-1.1.3.jar:jdom.jar:jaxen-1.1.1.jar:js.jar test
>
> >> and
>
> >> java test
>
> >> And so forth.
>
> >> I've run
>
> >> java -cp tagsoup-1.1.3.jar:jdom.jar:jaxen-1.1.1.jar:js.jar
> >> org.mozilla.javascript.tools.jsc.Main test.class
>
> >> but that does not seem to provide significant speed improvement. I used
> >> time() to evaluate it.
>
> >> Any help would be appreciated. I would like to ideally have this parser
> >> run significantly faster if at all possible.
>
> >> -Jon
>
> > Just looking at it, the command line "java -cp
> > tagsoup-1.1.3.jar:jdom.jar:jaxen-1.1.1.jar:js.jar test" looks fine.
> > What's going wrong? Do you get any error messages?
>
> > --N
>
> So the error is :
> Exception in thread "main" java.lang.NoClassDefFoundError: test
>
> However test.class is residing in the local directory.
>
> -Jon
Ah, I think you just need to add the directory containing the
test.class file to your classpath. Assuming it's in the current
directory:
java -cp tagsoup-1.1.3.jar:jdom.jar:jaxen-1.1.1.jar:js.jar:. test
For example, I did the following simple case:
[rhino] cat test.js
java.lang.System.out.println("hello, world");
[rhino] java -classpath js.jar org.mozilla.javascript.tools.jsc.Main
test.js
[rhino] java -classpath js.jar:. test
hello, world
--N
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino