Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] NoClassDefFoundError nu/xom/Element

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Asgeir Frimannsson" <asgeirf AT gmail.com>
  • To: "Rajesh Menon" <prm225 AT gmail.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] NoClassDefFoundError nu/xom/Element
  • Date: Fri, 7 Mar 2008 18:09:29 +1000

On Fri, Mar 7, 2008 at 6:51 AM, Rajesh Menon <prm225 AT gmail.com> wrote:

> Hi,
> I came across this issue from a while ago -
> http://cafe.elharo.com/blogroll/eclipse-classpath-insanity/ - but I'm
> not using Eclipse. Does anyone know how to resolve this?
> Thanks.
>
> $ cat Test.java
> import nu.xom.Document;
> import nu.xom.Element;
>
> public class Test
> {
> public static void main (String args[])
> {
> System.out.println (args[0] + ", " + args[1]);
>
> Element root = new Element ("root");
> root.appendChild ("hello world");
> Document doc = new Document (root);
> String result = doc.toXML();
> System.out.println (result);
> }
> }
>
> $ javac -classpath ~/src/scm/xom/build/xom-1.2b2.jar Test.java
>
> $ java Test foo bar
>

Try:

java -classpath ~/src/scm/xom/build/xom-1.2b2.jar Test foo bar


You need to specify the classpath when running your program as well.

cheers,
asgeir



> foo, bar
> Exception in thread "main" java.lang.NoClassDefFoundError: nu/xom/Element
> at Test.main(Test.java:10)
>
> $ java -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)
>
>
> --
> Rajesh Menon
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>




Archive powered by MHonArc 2.6.24.

Top of Page