xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett McLaughlin" <brett.mclaugh...@lutris.com>
Subject Re: Trying to use Xerces Java SAX classes
Date Tue, 05 Sep 2000 04:22:40 GMT


Bill Halchin wrote:
> 
> Thanks Ed (and everybody else!),
> 
>    Ok ...
> 
>     1) As I think I said before, I am running Red Hat 6.2.
> 
>     2) I am using the bash shell.
> 
>     3) In my .bashrc file, I have:
> 
>            CLASSPATH=$HOME/FTP/xerces-1_1_3/xerces.jar
>            export CLASSPATH
> 
>     4) I am running jdk117_v3 from blackdown.org
> 
> I am trying to compile an instance of the SAX Reader.
> 
> import org.xml.sax.XMLReader;
> 
> import org.apache.xerces.parsers.SAXParser;
> 
> public class SAXParserDemo { ...
> 
> This is from the book (pg 50) "Java and XML" by Brett McLaughlin
> published by O'Reilly. The problem I encountering is that the
> compiler cannot "find" the imported classes/interfaces. Previously,
> I had mispelled the env var as CLASS_PATH. Now it is correct, i.e.
> CLASSPATH. I source'd the .bashrc file and did an "echo $CLASSPATH",
> just to be sure everything was should be but .... the compiler (as a said
> above) cannot "see" the imported classes. Sigh....


Hi Bill. Let's see if we can help you out. Here's what we need:

1) The exact, copied/pasted error, such as:

SAXParserDemo.java:37: Class org.xml.sax.Attributes not found in import.
import org.xml.sax.Attributes;
...
...

2) The exact result of 'echo $CLASSPATH'

3) For each path in $CLASSPATH, the result of 'ls <path>'

So if 'echo $CLASSPATH' results in:

/foo/bar/xerces.jar:/foo/bar

Then you would do:

ls /foo/bar/xerces.jar

ls /foo/bar

This will ensure that your $CLASSPATH has actual entries that correspond
to exact files and directories, and that those exist. Once we get that,
plus the exact class missing, we can help you out. What your classpath
/should/ look like:

1) if xerces.jar is in /projects/lib/xerces.jar
2) if SAXBuilderDemo is in /projects/javaxml/SAXBuilderDemo.java

'echo $CLASSPATH' should give you:

/projects/lib/xerces.jar:/projects/javaxml

Remember that in addition to the xerces.jar, you need to have the
directory with the compiled Java class you are working on. So if you got
something like:

SAXParserDemo.java:37: Class org.xml.sax.Attributes not found in import.
import org.xml.sax.Attributes;

This would indicate that xerces.jar is missing from your classpath
(anything org.xml.sax or org.apache.xerces or org.w3c.dom)

Now if you get things compiled, then you could get errors from not
having the classes in your 'working directory' in the classpath, and you
would get an error like:

Exception in thread "main" java.lang.NoClassDefFoundError: SAXParserDemo

Let us know more about what is happening, and we'll get you hooked up
;-)


Thanks,
Brett

> 
> Thanks,
> 
> Bill halchin
> 
> >From: "Ed Staub" <estaub@mediaone.net>
> >Reply-To: general@xml.apache.org
> >To: <general@xml.apache.org>
> >Subject: RE: Trying to use Xerces Java SAX classes
> >Date: Mon, 4 Sep 2000 21:05:17 -0400
> >
> >You need to include the .jar files in your classpath, not just the
> >surrounding directory.  This is true for any .jar file.
> >
> >-Ed Staub
> >
> >-----Original Message-----
> >From: Bill Halchin [mailto:bhalchin@hotmail.com]
> >Sent: Monday, September 04, 2000 4:50 PM
> >To: general@xml.apache.org
> >Cc: bhalchin@hotmail.com
> >Subject: Trying to use Xerces Java SAX classes
> >
> >
> >Hello,
> >
> >     I am trying to use the Java SAX classes which reside in the
> >.jar files. I set my CLASS_PATH env var on Red Hat Linux to
> >point at the xerces directory. I am running the blackdown 117_v3
> >javac.
> >
> >1) Is it necesary to "unjar" the .jar files in order for javac to
> >       see the SAX classes?
> >
> >2) I tried running "jar -x xerces.jar" but the jar utility seems to
> >      be waiting for more from stdin?
> >
> >Thanks,
> >
> >Bill Halchin
> >_________________________________________________________________________
> >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> >
> >Share information about yourself, create your own public profile at
> >http://profiles.msn.com.
> >
> >
> >---------------------------------------------------------------------
> >In case of troubles, e-mail:     webmaster@xml.apache.org
> >To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> >For additional commands, e-mail: general-help@xml.apache.org
> >
> >
> >---------------------------------------------------------------------
> >In case of troubles, e-mail:     webmaster@xml.apache.org
> >To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> >For additional commands, e-mail: general-help@xml.apache.org
> >
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
> 
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

-- 
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 
http://www.lutris.com
http://www.enhydra.org

Mime
View raw message