Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError

 
Mohammad Farhat
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys,
i've got this issue...
when i run my applet code inside jbuilder (using jdk1.4.2_08), i get it to run correctly, yet when i run it outside using a browser (which is supposingly using the same jdk-i set this in the control panel to use the same jdk), i get , after the applet running much code, a java.lang.NoClassDefFoundError...
eventhough the class is there !!!
i am really confused about this
Thanks guys...
Best,
---Mohammad
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception message should tell you which class is not found -- what does it say?
 
Mohammad Farhat
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest,
that is correct, i am getting the following exception i am printing "this" which is the originating class)
this rg.dcm4cheri.imageio.plugins.DcmImageReaderSpi@2af081
java.lang.NoClassDefFoundError
at org.dcm4cheri.imageio.plugins.DcmImageReaderSpi.createReaderInstance(DcmImageReaderSpi.java:126)
at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:296)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:488)
at javax.imageio.ImageIO.read(ImageIO.java:1381)
at javax.imageio.ImageIO.read(ImageIO.java:1348)
at dicomviewer.ImageData.setDataAndCreateImage(ImageData.java:499)
at dicomviewer.ImageData.setDicomData(ImageData.java:122)
at dicomviewer.DicomFile.load(DicomFile.java:287)
at dicomviewer.Viewer.postData(Viewer.java:376)
at dicomviewer.LoaderThread.run(LoaderThread.java:54)

The instruction at which it is crashing is
return new DcmImageReader(this);
knowing that DcmImageReader is an existing class !
Any ideas?
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't have to be DcmImageReader that's missing; it could be a class that DcmImageReader refers to. Classes are loaded lazily, so this may be the first time DcmImageReader is being loaded, and some other class that it uses isn't available. Are there any libraries which you're using in the development environment that aren't present in the applet environment?
 
Mohammad Farhat
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually,
i have everything packaged inside a jar file (i am using my own code, in addtition to some other code ... dcm4che open source library for DICOM images)
and i am using the jar file in the browser
how do i make sure that nothing is missing there?
besides, why would anything be missing if i am compiling all my classes, and they are running first inside jbuilder?
Thanks a lot Ernest...
Best,
---Mohammad
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you run it under JBuilder, it very well might use your machine's CLASSPATH, for example -- I don't know for sure. But look at the class in question, look at what libraries it uses, and use "jar tf jarfile.jar" to get a listing of the jar file to check and make sure they're there.
 
Ebunoluwa Adedoye
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did u try to creat an html file that will be saved in the same folder with the programname.class file.if u have created an html file than check if there is no space between the code.this is an example of a html file.
<html>
<applet code="programname.class"width="300"height="100">
</applet>
</html>
u will save this in the same file with the.class of ur program than save this html file with an html extension than go to the folder u saved the html file and click on it.
 
Mohammad Farhat
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest, I did check that all classes are in the jar file being used..
and Ebunoluwa, I also tried using the classes instead of the jar file,
both ways led to no progress
MayDay .. MayDay .. HELP !
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're unpacking the jar files that other libraries come in, maybe you're neglecting to include everything in those jar files? This happened in a project I worked on some time ago: we were unjarring many libraries and combining all the class files they contained into one big jar file, but it turned out that one of the jar files included some data in a file in its jar file's META-INF directory that it absolutely needed, and wouldn't load without. Perhaps you're leaving out something important in building that one jar file?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic