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

ClassNotFoundException while using Applet

L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
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.


SCJP, SCWCD
Dan Richardson
Greenhorn

Joined: Aug 06, 2002
Posts: 23
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

Joined: Jul 05, 2001
Posts: 395
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

Joined: Jul 05, 2001
Posts: 395
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

Joined: Aug 06, 2002
Posts: 23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassNotFoundException while using Applet