Embedded HTML files with Applet in eclipse

Source: Internet
Author: User

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 ~ :)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.