Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with an applet

 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Documents\Main\class.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native 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

<HTML>
<TITLE>applet experiment</TITLE>
<Body>
<h1> first applet</h1>
<applet
code=Main.class
width=300
height=300
archive=third.jar
name=instance-name
codebase=C:\Documents and Settings\Vivek\Desktop\applet experiments
>
</applet>
</BODY>

Where Main.java 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.

Thanks,
Vivek.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are both the HTML file and Main.class in the C:\Documents directory? If so, try "code=Main" instead of "code=Main.class".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic