For Programmers: Free Programming Magazines  


Home > Archive > Java Help > February 2006 > NoClassDefFoundError in applet when extra classes are added









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author NoClassDefFoundError in applet when extra classes are added
Zyryab

2006-02-28, 7:04 pm

Hello, all.

I'm using NetBeans 4.1 on winXP to build my very first applet, and i
think I'm missing a very basic concept about the way applets are
deployed.

My applet was running fine in the browser until I added some Java
Imaging Utilities (JIU) classes to my project. Now, while the applet
still compiles and runs in the NetBeans environment, I can't get it to
run inside the browser.

I get the following errors in the java console:

Java Plug-in 1.5.0_06
Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
-------------------------
java.lang.NoClassDefFoundError: net/sourceforge/jiu/data/PixelImage
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-4" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-ImageViewer.class"
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
-------------------------

My main applet class is in a directory called "classes", and I've
placed the entire JIU directory tree in the same directory
(classes/net/sourceforge/jiu/...)

The code and a screenshot of the directory structure can be found at:
http://radiologycasefiles.com/code.html
Please be gentle. I know it's ugly and probably breaks a lot of
conventions and rules.

Any help would be greatly appreciated.

-Z

klynn47@comcast.net

2006-02-28, 9:57 pm

You need to include the .jar file containing those classes as an
archive when you load the applet.

Zyryab

2006-02-28, 9:57 pm

D'oh. Thanks a million. This fixed everything.

<APPLET codebase="classes/" code="ImageViewer.class" archive="jiu.jar"
width=500 height=530></APPLET>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com