I made this very simple applet just for fun but it doesn't work:

package applet;

import java.awt.*;

public class Applet extends java.applet.Applet
{
    public void init()
    {

    }

    public void paint(Graphics g)
    {
        g.drawOval(0, 0, 250, 100);
        g.setColor(Color.RED);
        g.drawString("First Applet", 10, 50);
    }
}

And heres my HTML code:

<html>
<head>
<title> App </title>
</head>
<body>
Program <br/>
<applet code="Applet.class" width="300" height="300"></applet>
</body>
</html>

It gives this error:
ClassNotFoundException

What is wrong and how do I fix it?

Calling your class Applet isn't an error as such, but is guaranteed to cause problems since Applet is an exsting class in the API that you are trying to use at the same time. First thing to do is to change it to a unique name. (Don't forget to change the .java dile name to match).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.