aspose file tools*
The moose likes Beginning Java and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic
Author

NoClassDefFoundError

budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
I have used a third party api htmlparser.jar and i have kept that jar file in jdk/jre/lib/ext . Then i wrote the following code in my .java file
import org.htmlparser.beans.*;
import org.htmlparser.util.ParserException;
//and much more imports

Now when i compiled the code it gave me no errors but when i tried to run the code it gave me NoClassDefFoundError . for that i checked out the .jar file and to the best of my knowledge it's ok . So why am i getting this error ?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

I am surprised that you dont get compilation error. hmmm, ok please have a look at this . this may help you
budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
I saw the tutorial and i know how to set the classpath as well but this hasn't solve the problem .
budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
Here's what i did in the command prompt
set classpath=D:\gagan\jdk1.6.0_22\jre\lib\ext;C:\Documents and Settings\g\Desktop\testspace

testspace is the directory where my .java file is kept and ext is the directory where my .jar file is kept .
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

What is the class name reported by NoClassDefFoundError?

And we would like to have a look at the code as well. May be you could post a ssce


Mohamed Sanaulla | My Blog
 
Don't get me started about those stupid light bulbs.
 
subject: NoClassDefFoundError