The problem is that an applet is written in eclipse, a package is used, and an HTML file is created. The program cannot run after the applet is embedded. If the package is not used, however, you can directly copy the program to the defaultpackage file. Http://topic.csdn.net/u/20080913/13/2d33fec4-c4a3-4349-b3d7-06fadce7d024.html
Ignore the consequences of Package
The source file helloapplet. Java is in the package applet, so there is such a line in the first line of the source file:
Package applet; it is no problem to run a small application in eclipse, but the classnot found exception will be thrown when you use IE browser to run HTML files or the appletviewer command to run HTML files.
The helloapplet.html code is as follows:
<HTML>
<Head>
<Title> Hello applet! </Title>
</Head>
<Body>
<APPLET code = "helloapplet. Class" width = 300 Height = 100>
</APPLET>
</Body>
</Html> <APPLET code = "helloapplet. Class" codebase = "D: \ eclipseworkspace \ helloworld \ bin \ applet" width = 300 Height = 100>
</APPLET>
Codebase points out the base directory where the class file is located, but it still reports the same error for a long time. Later, Guanghua pointed out that the error is related to the package statement in the first line of the source file.
The definition class format in the reference package should be applet. helloapplet, so the reference method of the corresponding binary file should also be changed to applet. helloapplet. Class. Therefore, the <APPLET code = "applet. helloapplet. Class" codebase = "D: \ eclipseworkspace \ helloworld \ bin" width = 300 Height = 100>
</APPLET>
So OK ~ :)