K
Karen Jenkins
I know this is supposed to be extremely simple but I have toiled for hours
over this and just cannot see what I am doing wrong. Can anyone point out
my mistake?
The environment is Java 6 Update 10 b25 on Windows Vista. I have a folder
D:\Test and in it I have 2 files namely applet.jar and applet.html. The
applet.jar contains one class namely MyApplet. The contents of the HTML
file are:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<applet code="MyApplet" archive="applet.jar" width="492"
height="280">
</applet>
</body>
</html>
As I said, all very simple. Now I am not concerned at this point what the
applet actually does - I just can't even get it to find it. When I run/open
the HTML file in any browser I get the following exception:
load: class MyApplet not found.
java.lang.ClassNotFoundException: MyApplet
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: D:\Test\MyApplet.class (The system
cannot find the file 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: MyApplet
Why doesn't this work? I have tried adding ".class" the the code tag but
then it looks for MyApplet.class.class and I have tried putting the full
path to the applet.jar but the result is the same.
Anyone?
Cheers,
Karen (tearing her hair out!)
over this and just cannot see what I am doing wrong. Can anyone point out
my mistake?
The environment is Java 6 Update 10 b25 on Windows Vista. I have a folder
D:\Test and in it I have 2 files namely applet.jar and applet.html. The
applet.jar contains one class namely MyApplet. The contents of the HTML
file are:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<applet code="MyApplet" archive="applet.jar" width="492"
height="280">
</applet>
</body>
</html>
As I said, all very simple. Now I am not concerned at this point what the
applet actually does - I just can't even get it to find it. When I run/open
the HTML file in any browser I get the following exception:
load: class MyApplet not found.
java.lang.ClassNotFoundException: MyApplet
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: D:\Test\MyApplet.class (The system
cannot find the file 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: MyApplet
Why doesn't this work? I have tried adding ".class" the the code tag but
then it looks for MyApplet.class.class and I have tried putting the full
path to the applet.jar but the result is the same.
Anyone?
Cheers,
Karen (tearing her hair out!)