aspose file tools*
The moose likes XML and Related Technologies and the fly likes Oreilly's Java & XML Book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Oreilly Watch "Oreilly New topic
Author

Oreilly's Java & XML Book

Eric Rosen
Greenhorn

Joined: Jan 06, 2001
Posts: 3
hi everyone,
if anyone else is reading this book, i could sure use your help.
i've downloaded the latest xerces XML parser and i placed xerces.jar and xercesSamples.jar on my NT classpath
from the DOS prompt, i can get their sample examples to work fine.
when i try to run the first SAXParserDemo example in chapter 3 of the book, i keep getting java.lang.NoClassDefFound in "main" error with respect to SAXParserDemo
when i compiled the example (using J++), i had the xerces.jar on my project classpath and it compiles without a hitch
anyone have any ideas what i should try next?
many thanks,
--eric
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Check whether you have all required classes in your classpath when you try to run it.
If so, check the example. There have been some changes (quite a few in fact) to SAX since the book came out, and some things have been deprecated.


42
Brett Knapik
Ranch Hand

Joined: Oct 15, 2000
Posts: 255
or maybe its j++ MS always changes stuff
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
Eric Rosen
Greenhorn

Joined: Jan 06, 2001
Posts: 3
jeroen,
i'm am somewhat new to java development so please bear with my naive questions...
about classpaths and having all required class on the classpath...
which classpath are we talking about?
the classpath which is an NT environment variable or the classpath which the J++ IDE uses when it compiles?
either way, i placed the xerces.jar on both classpaths.
i would have thought that if all the import statements in the example reference packages found in xerces.jar, i should be OK
am i missing something?
finally, do IDE's ever expect individual class files to be added to their classpath's?
many thanks,
--eric
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
Hi Eric,
I fighted with similar stuff, too last week. Make sure that your class (SAXParserDemo)is in the class-path. Try
set Classpath=%Classpath%;.
hope it helps
Axel

Eric Rosen
Greenhorn

Joined: Jan 06, 2001
Posts: 3
axel,
many thanks for your help.
again, please indulge my naive questions regarding classpaths...
just wanted to clarify that your advice is with respect to the classpath in NT
if so, what does it mean to say, %classpath% AND what should i type after that?
also, how do i tell NT or my IDE that i want to include the SAXParserDemo in the classpath?
many thanks,
--eric
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
Hi Eric,

if so, what does it mean to say, %classpath% AND what should i type after that?

I would call Classpath a OS Environment Variable. You can get the current value of this variables by typing set.
The command
set Classpath = %Classpath%,.
means that you add your CURRENT path (something like E:\java\myXML) to the ACTUAL Classpath (%Classpath% is something like a copy of the value of the classpath-Variable). If you do this setting in the DOS-Window your setting is local for this session.
You can change settings globaly in NT. Think it was in Settings/System.
good luck
Axel
You can change
also, how do i tell NT or my IDE that i want to include the SAXParserDemo in the classpath?
many thanks,
--eric
[/B]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oreilly's Java & XML Book