The APPLET tag in an HTML document identifies the name of a Java program called an applet included in a Web page. The name of the applet is called its class name. This name associated with the executable bytecodes that run the applet.

Put the following lines in a file called bhj.html:

“<HTML>

<HEAD>

<TITLE>CPWebHosting – Control Panel Web Hosting</TITLE>

</HEAD>

<BODY>

<APPLET Code=”Hi.class” Width=”600″ Height=”300″>

</APPLET>

</BODY>

</HTML>“

In the example, there is an open APPLET tag, <APPLET>, and a close APPLET tag, </APPLET>. The attributes shown here are Code, to identify the class file which contains the Java bytecodes and the Width and Height attributes, measured in pixels, to describe how much room should reserved on the Web page for the applet.

Let me provide you the general syntax of the APPLET TAG

<APPLET

Codebase = “path to a directory containing class files.”

Code = “name of class file”

Width = “width of applet in pixels”

Height = “height of applet in pixels”>

<PARAM Name=”parameter name” Value=”value of parameter”>

<PARAM Name=”parameter name” Value=”value of parameter”>

</APPLET>

here is a minimal Java applet that will help you:

import java.awt.Graphics;

/**

A first hello.

*/

“public class Hi extends java.applet.Applet {

public void init() {

resize(600, 300);

}

public void paint(Graphics context) {

context.drawString(“Hello, world!”, 50, 100);

}

}“

You can place Java code in a file named bhj.java. Next, you have to compile the Java source code using the Java compiler, javac. At the operating system prompt ($), enter:

$ javac bhj.java

If there are no errors, the compiler will create a file named bhj.class that contains the bytecodes for the HelloWorld applet.

So at this point, you have the following:

*A file called bhj.html. This is the hypertext markup language (HTML) source file.

*A file called bhj.java. This is the Java language source file.

*A file called bhj.class. This is the Java bytecode file.

If you have a Java-enabled browser, you can test this applet. Use the browser to open the file HelloWorld.html. Alternatively, you can also use the applet viewer supplied with the Java Developer’s Kit (JDK) to view applets without having to make an HTML page to reference them.

Once the applet is downloaded, it need not be downloaded again, even if the applet code defines repeated loops or other interaction. The user might use a downloaded applet several times over the course of an online session without any more network retrievals.

Java enabled and non-enabled browsers

In a non-Java Web browser, the downloaded content defined concerning Multipurpose Internet Mail Extensions (MIME) specifications, which include a variety of multimedia document formats. The browser needs to employ a helper application such as in displaying images, sound, and video to display the content.

In a Java-enabled browser, the same pattern is followed, but one more crucial step is added. First, the Java-enabled browser, following requests by the user, downloads content defined by MIME specifications and displays it. However, a Java-enabled browser recognizes a particular hypertext tag called APPLET which is a special kind of Java program. The browser then downloads another file of information, as named in an attribute of the APPLET tag, that describes the execution of that applet which is called bytecode.

The Java-enabled browser interprets these bytecodes and runs them as an executable program on the user’s host. The resulting execution on the user’s host then drives the animation, interaction, or further communication. This execution of content on the user’s host is what sets Java content apart from the hypertext and other multimedia content of the Web. The downloading and start of the execution of content happens automatically.

The user does not specifically have to request this content or start its execution, this executable content is platform-independent, Java programmers need not create separate versions of the applets for different computer platforms, as long as the user has a Java interpreter (or Java-enabled browser) installed on his or her computer.

That means that the resulting executable content shifts the site of activity from the Web server to the Web client (the Java-enabled browser).