Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException while using Applet

 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am using JRun 3.1 and trying to use Applet with a JSP file.
In the applet I am using jaxp.jar and crimson.jar classes to work with XML file.
When I compile the applet, it compiles fine without any errors.
But when using the applet in my JSP file it gives following error.
I have updated the default and admin server classpath with the jar files. Also my system classpath environment variable is updated with these jar files.
Here is the details of the error in java console.
java.lang.NoClassDefFoundError: org/w3c/dom/Node
at java.lang.Class.newInstance0(Native Method)
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)
Thanks.
 
Dan Richardson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to use jar files with an applet, you will have to include archive tags within your <APPLET></APPLET> tags. Have you included this parameter? Here's an example:
<APPLET
CODEBASE = codebase URL
CODE = applet class
ARCHIVE = crimson.jar,jaxp.jar
.
.
.
>
.
.
.
</APPLET>
The classes in the jar file are loaded using an AppletClassLoader. The AppletClassLoader uses the codebase attribute to find the jars.
 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks. I will check it out.
Can you please explain how exactly the applet will work when I have imported the JAXP jar files and opening the xml file on my server.
I mean I want to know the life cycle of this.
Regards.
 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well,
I have used this...
<Applet code = "test.class" width = 600 height =380 archive="pvAll.jar" name=test id=test>
Its not working.!!!
Thanks
 
Dan Richardson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on the Applet tags you are using, your pvAll.jar file needs to be in the same directory as your test.class file. Is this the case? If not, the AppletClassLoader will not find the jar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic