Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I successfully create a Java applet in an html file?

I want to create a Java applet that interacts with the user just like it would if it was running in the program's IDE. This can be done by creating an html file and specifying the byte code file from the Java source code. This is what I have tried so far:

<html>

<head>

</head>

<body>

<applet code="Conversion.class" WIDTH="800" HEIGHT="500">

</applet>

</body>

</html>

The program Conversion.java is a BreezySwing GUI program that was made in JCreator. I opened it up and changed some things to make it suitable for use in an applet:

1. The class name now extends GBApplet

2. The method "main" was deleted

3. There is no use of the setTitle method

4. The constructor was replaced with "public void init()"

I compiled this program to get the byte code file (.class) and then put it into the html file. I was able to create the html file, however, when I opened it, the area where the program message box should have been was blank and replaced with the statement "Error. Click for details". The error message that was given was: "NoClassDefFoundError", which I have seen a lot in my programs, but I do not know what to do about it. I already performed and double checked the instructions in my textbook on how to do this and I still receive errors.

What do I need to do to my process so that I do not receive any errors when I try to run the applet?

2 Answers

Relevance
Still have questions? Get your answers by asking now.