I have created an applet program using Eclipse IDE. Now im creating .html file as below:
<html>
<APPLET CODE="Chase.class" width=500 height=400>
</APPLET>
</html>
When Im executing this file the error im getting is:
java.lang.NoClassDefFoundError: Chase (wrong name: pong/Chase)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
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)
In Eclipse IDE is have created new project and packaged the program into "pong" folder.
Can anybody explain why this error is occuring?
Edit:
Adding few Chase.java code lines, for clarification. It is simple applet:
package pong;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
public class Chase extends Applet implements Runnable
{ ... }
There is no class name Chase
in your classpath.
wrong name
specifies there might be mistake with class name with package specified.
if your class declares package
for example
package a;
public class MyApplet extends Applet{}
then in HTML give a.MyApplet
Update
in your case it seems
<APPLET CODE="pong.Chase.class" width=500 height=400>
also dir structure should be
- - - - -
|
|-your html file
|-pong folder
|
|- Chases.class
will do if package name is pong
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With