This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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
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.
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."
Joined: Jan 06, 2001
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
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
Joined: Jan 06, 2001
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
Joined: Jan 08, 2001
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]