0

When I run my html file, it gives me this error:

noclassdefFoundError, applet(wrong name:testapplet/applet) details

Java Plug-in 10.65.2.20

Using JRE version 1.7.0_65-b20 Java HotSpot(TM) Client VM

applet.class and applet.html are in the same folder: \testapplet\bin\testapplet.

Applet code:

package testapplet;

import java.awt.Graphics;
import javax.swing.*;

public class applet extends JApplet
{
    public void paint(Graphics g)
    {
        g.drawString("Acesta este un applet",320,180);
    }
}

Html code:

<html>
    <head>
        <title>Applet app</title>
    </head>

    <body>
    <embed type="application/x-java-applet;version=1.7"
           width="512" height="512"
           code="applet.class" 
     />
    </body>
</html>
Radu Gabriel
  • 49
  • 1
  • 1
  • 4

1 Answers1

0

If your applet class is in testapplet package, put the html file in the parent directory i.e. inside bin in this case.

You should not put applet.html i the same folder as applet.class if you applet class has a package specified.

This should work.

user63762453
  • 1,734
  • 2
  • 22
  • 44