This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
hi friends , i am new to xml.i am trying to run a sax parser program and i am getting some errors.can you please help:-
Java file:-
xml file:-
Warnings while compiling:- C:\shanker\xmlfiles>javac -deprecation BooksLibrary.java BooksLibrary.java:18: warning: org.xml.sax.HandlerBase in org.xml.sax has been d eprecated public class BooksLibrary extends HandlerBase ^ BooksLibrary.java:64: warning: org.xml.sax.AttributeList in org.xml.sax has been deprecated public void startElement (String name, AttributeList attrs) ^ BooksLibrary.java:64: warning: org.xml.sax.AttributeList in org.xml.sax has been deprecated public void startElement (String name, AttributeList attrs) ^ 3 warnings
Errors while trying to run the program:- C:\shanker\xmlfiles>java BooksLibrary Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/HandlerBa se at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:493) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11 1) at java.net.URLClassLoader.defineClass(URLClassLoader.java:248) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:299) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286) at java.lang.ClassLoader.loadClass(ClassLoader.java:255) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
Please help thanks.
Edit Comment: When posting code, please use the [ code ] [ / code ] tags without the spaces. Thanks.
- m [ November 04, 2004: Message edited by: Madhav Lakkapragada ]
hi guy, You r using a deprecated methods of SAX API. You can compile your file as like this 'javac FileName -deprecation' , Now it will compile. Even u have to use the JDK version 1.3 and above and check whether class path is set properly .
Regards, Dathathreya Reddy
sai Narayan
Greenhorn
Joined: Aug 16, 2004
Posts: 21
posted
0
hi datatreya, i have jsdk1.4.i tried using javac filename -deprecation but even then i am getting 3 warnings .when i try to run then i am getting an error saying NoClassDefFoundError org/sax/handlerBase not found. can you please help. thanks
If that is really the error, you are using a bad package somewhere. org.xml.sax.HandlerBase is the correct full name. Even though the class is deprecated I think you should be able to get it to work. Bill
Your program runs fine. There's no runtime problem with deprecated classes/messages. To me it looks like a simple Java 101 error with the CLASSPATH.
Since you are using JSDK 1.4, add the JAVA_HOME\lib path to your CLASSPATH inaddition to the '.' current directory and you should be able to run the file, thus echoing the XML file.
BTW, you might want to pay close attention to the package names/paths. If you make typos, you wouldn't even be able to compile. Regds.
- m
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
posted
0
I am closing this thread. Continue the discussion in your other thread.