Hi all,

Im trying to run a simple applet which prints a message to the screen..The applet runs fine on applet viewer but when i try to view it in the URL bar i get the following error:

load: class Test.TestApplet.class not found.
java.lang.ClassNotFoundException: Test.TestApplet.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.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:\Java\NetworkingAssignment\TestApplet\Test\TestApplet\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)
... 9 more
Exception: java.lang.ClassNotFoundException: Test.TestApplet.class

The code for the html file and applet are as follows:

package Test;
import java.applet.Applet;
import java.awt.Graphics;

public class TestApplet extends Applet {
	public void paint(Graphics g){
		g.drawString("Hello World", 25, 25);


<applet code = "TestApplet.class" width = "256" height = "256">


TestApplet.class is located in the bin directory of the project and index.html is located directly in the project folder..

Where should the index.html file be?? Is it suppose to be in the same folder as the .class file?? Any help appreciated

Are you talking about the JDK bin directory??

Nothing should really be in a bin directory. Set up a small directory with index.html and a separate folder called applet.

<applet code = "applet/TestApplet.class"></applet

Or just have both files in the same place

This article has been dead for over six months. Start a new discussion instead.