Re: Applets and Inner class problems

From: Alex Hunsley (lard_at_tardis.ed.ac.molar.uk)
Date: 12/12/03


Date: Fri, 12 Dec 2003 17:27:00 +0000

Chabonga wrote:

> I feel really dumb right about now. I have adapted an example from
> sun's site to suit my needs for an image pan and zoom tool. In
> eclipse, the applet runs fine, given the proper parameters are passed.
> When I embed the applet in a html page, the JRE console gives me
> these errors:
>
> java.lang.NoClassDefFoundError: imagezoom$DrawingPane
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
> at java.lang.Class.getConstructor0(Unknown Source)
> .
> .
> .
>
> The applet tag I am using looks like:
>
> <applet code="imagezoom.class" width="300" height="300">
> <param name="name" value="imagezoom.class">
> <param name="imagename" value="D0001636.jpg">
> <param name="path" value="images">
> Sorry, your browser can't display applets.
> </applet>
>
> I have tried various modifications of this with no luck.
>
> DrawingPane is an inner class of imagezoom, the source code of which
> looks like:
>
> Can anyone see what I am doing wrong? TIA,
>
> Trev

Internal classes get compiled to seperate class file. In this case you
will end up with a class file called imagezoom$DrawingPane.class as well
as one called imagezoom.class. Why don't you put all your classes
(including the inner class file imagezoom$DrawingPane) in a jar, and
upload that instead. Then you'd reference it as:

  <applet code="imagezoom.class" archive="imagezoom.jar" width="300"
     height="300">

Note that in the above I have added an archive parameter for specifying
your jar!

alex



Relevant Pages

  • Re: java script and hosting
    ... I don't know how to use JAR to house the applet. ... Can I simply zip the class file and rename it to ... can you tell me what browser and version you are using? ...
    (comp.lang.java.programmer)
  • Re: Vicki, Is There A Difference ?
    ... in my experience lots of images being called ... up to one applet class file dont work well unless you have the appropriate ... class file which is designed to accomodate multiple images...and the images ... Do you think the removal of the flashing frames made a difference in download time? ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress.stationery)
  • Re: Applets and Deep Jar Structure
    ... The html file containing the applet ... and the jar file exist in the same folder. ... What do you want to do with the class file once you find it? ... where this is a class in that package. ...
    (comp.lang.java.help)
  • Re: java script and hosting
    ... The applet is not supposed to be seen. ... My class is not in JAR. ... simply a class file in the same folder as the pages. ... can you tell me what browser and version you are using? ...
    (comp.lang.java.programmer)
  • Re: Sun Server and applets
    ... since it is a class file. ... A servlet gets executed on the server, while an applet ... Since nothing under WEB-INF is visible to client browsers, ...
    (comp.lang.java.programmer)