You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Admin@orangesoftware.net" <ad...@orangesoftware.net> on 2001/03/24 04:35:00 UTC

this is killing me - NoClassDefFoundError

All I'm trying to do is try out Xerces. When I run my program it complains:
Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/SAXException

I just don't get what I'm doing wrong. 

This is how I build:
c:\jdk1.3\bin\javac  -classpath c:\jdk1.3\xerces-1_3_0\xerces.jar  Dommy.java

And this is how I run:
set CLASSPATH=
c:\jdk1.3\bin\java Dommy -jar c:\jdk1.3\xerces-1_3_0\xerces.jar

Anyone have any ideas?
Thanks.

--------------------------------------------------------------------------------


import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import java.io.IOException;

public class Dommy 
{
 public Dommy()
 {
  String xmlFile = "file:map.xml"; 

  DOMParser parser = new DOMParser();

  try {
      parser.parse(xmlFile);
  
  } catch (SAXException se) {
      se.printStackTrace();
  } catch (IOException ioe) {
      ioe.printStackTrace();
  }

  Document document = parser.getDocument();
 }

 public static void main(String args[])
 {
  Dommy t = new Dommy();
 }
}



Re: this is killing me - NoClassDefFoundError

Posted by Sanjay Bhatia <sb...@yahoo.com>.
Try adding the xercesSamples.jar file to your classpath.

sb


--- "Admin@orangesoftware.net" <ad...@orangesoftware.net> wrote:
> All I'm trying to do is try out Xerces. When I run my program it complains:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/xml/sax/SAXException
> 
> I just don't get what I'm doing wrong. 
> 
> This is how I build:
> c:\jdk1.3\bin\javac  -classpath c:\jdk1.3\xerces-1_3_0\xerces.jar  Dommy.java
> 
> And this is how I run:
> set CLASSPATH=
> c:\jdk1.3\bin\java Dommy -jar c:\jdk1.3\xerces-1_3_0\xerces.jar
> 
> Anyone have any ideas?
> Thanks.
> 
>
--------------------------------------------------------------------------------
> 
> 
> import org.apache.xerces.parsers.DOMParser;
> import org.w3c.dom.Document;
> import org.xml.sax.SAXException;
> import java.io.IOException;
> 
> public class Dommy 
> {
>  public Dommy()
>  {
>   String xmlFile = "file:map.xml"; 
> 
>   DOMParser parser = new DOMParser();
> 
>   try {
>       parser.parse(xmlFile);
>   
>   } catch (SAXException se) {
>       se.printStackTrace();
>   } catch (IOException ioe) {
>       ioe.printStackTrace();
>   }
> 
>   Document document = parser.getDocument();
>  }
> 
>  public static void main(String args[])
>  {
>   Dommy t = new Dommy();
>  }
> }
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: this is killing me - NoClassDefFoundError

Posted by Rajesh K R <ra...@trigent.com>.
hey
It would be  better if u put the xerces.jar file first in ur classpath

As far as  execution is concerned why do u need u unjar  tha xerces .jar.

first of all u remove the xerces dir from jdk1.3
and put this in ur root directory.
set the classpath as
set classpath=%classpath %.;c:/xerces-1_3_0\xerces.jar;

all u need to do is
compile the java class and run it depending on the type of parsing(sax/dom)
ur using

I thnk this should wrk out

Regards
Raj

----- Original Message -----
From: "Ian Roberts" <ir...@decisionsoft.com>
To: <xe...@xml.apache.org>
Sent: Saturday, March 24, 2001 5:11 PM
Subject: Re: this is killing me - NoClassDefFoundError


> On Fri, 23 Mar 2001, Admin@orangesoftware.net wrote:
>
> > All I'm trying to do is try out Xerces. When I run my program it
complains:
> > Exception in thread "main" java.lang.NoClassDefFoundError:
org/xml/sax/SAXException
> >
> > I just don't get what I'm doing wrong.
> >
> > This is how I build:
> > c:\jdk1.3\bin\javac  -classpath c:\jdk1.3\xerces-1_3_0\xerces.jar
Dommy.java
> >
> > And this is how I run:
> > set CLASSPATH=
> > c:\jdk1.3\bin\java Dommy -jar c:\jdk1.3\xerces-1_3_0\xerces.jar
>
> The -jar option to java is for running jar files which specify a main
> class in their manifest.  What you need to do is:
>
> c:\jdk1.3\bin\java -cp c:\jdk1.3\xerces-1_3_0\xerces.jar;x:\classes Dommy
>
> (where x:\classes should be replaced with the directory where your class
> files live)
>
> Ian
>
> --
> Ian Roberts, Software Engineer        DecisionSoft Ltd.
> Telephone: +44-1865-203192            http://www.decisionsoft.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: this is killing me - NoClassDefFoundError

Posted by Ian Roberts <ir...@decisionsoft.com>.
On Fri, 23 Mar 2001, Admin@orangesoftware.net wrote:

> All I'm trying to do is try out Xerces. When I run my program it complains:
> Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/SAXException
> 
> I just don't get what I'm doing wrong. 
> 
> This is how I build:
> c:\jdk1.3\bin\javac  -classpath c:\jdk1.3\xerces-1_3_0\xerces.jar  Dommy.java
> 
> And this is how I run:
> set CLASSPATH=
> c:\jdk1.3\bin\java Dommy -jar c:\jdk1.3\xerces-1_3_0\xerces.jar

The -jar option to java is for running jar files which specify a main
class in their manifest.  What you need to do is:

c:\jdk1.3\bin\java -cp c:\jdk1.3\xerces-1_3_0\xerces.jar;x:\classes Dommy

(where x:\classes should be replaced with the directory where your class
files live)

Ian

-- 
Ian Roberts, Software Engineer        DecisionSoft Ltd.
Telephone: +44-1865-203192            http://www.decisionsoft.com


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org