After creating an applet, You need to compile an HTML file to run the applet.
In the HTML file, configure the following proxy (myapplet.html ):
<HTML lang = "En-us">
<Head>
<Title> applet HTML page </title>
</Head>
<Body>
<APPLET codebase = "E: \ myapplet" code = "test. myapplet. Class"
Width = 350 Height = 200> </APPLET>
</Body>
</Html>
Here, codebase refers to the root category of the Class Object Storage object. For example, the full name of my class object is test. myapplet. class (test is the package name, And myapplet is the class name ),
My test. myapplet. Class is placed under E: \ myapplet.
Code refers to the class file with the full name of example (here, my class name is myapplet and the package name is test, so the generated class full name example should be named test. myapplet. Class)
In this case, after the myapplet. Java file is completed in zookeeper,
You can use the appletviewer command to view the running effect of the program.
The myapplet. Java Runtime is as follows:
Package test;
Import java. AWT. graphics;
Import javax. Swing. japplet;
Import javax. Swing. jbutton;
Public class myapplet extends japplet {
Public void Init (){
System. Out. Print ("=========== init ====================== ");
Add (New jbutton ("applet "));
}
}
The name of the HTML file is myapplet.html.
In the command line, perform the following operations:
E: \ myapplet> javac-D. myapplet. Java
E: \ myapplet> appletviewer myapplet.html
It should be noted that a memory number <Param name = archive value = "...">
The value of archive corresponds to the jar package that may be used in the program before that. Most of these jar packages are placed in the main directory of the Web application program before that,
In this way, the jar package name can be used directly when the value corresponding to the archive is ready.