aspose file tools
The moose likes Applets and the fly likes Problem with an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Problem with an applet" Watch "Problem with an applet" New topic

Problem with an applet

Vivek Alampally
Ranch Hand

Joined: Jul 10, 2008
Posts: 67
Hi everybody,
I have developed an applet using eclipse ide. When I tried to run it from ide(Run as Applet..) it works fine. The problem is when I tried to the same thing from an HTML file it is giving an exception

load: class Main.class not found.
java.lang.ClassNotFoundException: Main.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$ Source)
at Source)
Caused by: C:\Documents\Main\class.class (The system cannot find the path specified)
at Method)
at<init>(Unknown Source)
at<init>(Unknown Source)
at Source)
at Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$ Source)
at Method)
... 7 more
Exception: java.lang.ClassNotFoundException: Main.class

What I did exactly is

1. I made a jar file of my project using eclipse ide. Using Export.....
2. Next I created an HTML file

<TITLE>applet experiment</TITLE>
<h1> first applet</h1>
codebase=C:\Documents and Settings\Vivek\Desktop\applet experiments

Where is a file which extends JApplet.
third.jar is a jar file which I created.
and C:\Documents and Settings\Vivek\Desktop\applet experiments is a directory in which third.jar file, my HTML file resides.

I will be very thankful if anyone can help me to solve this.

Lester Burnham

Joined: Oct 14, 2008
Posts: 1337
Are both the HTML file and Main.class in the C:\Documents directory? If so, try "code=Main" instead of "code=Main.class".
It is sorta covered in the JavaRanch Style Guide.
subject: Problem with an applet