Executing the Program

After successfully compiling the source code "Hello.java" you will notice a new file has been added to the directory called "Hello.class"

That file contains the intermediate code that the run time package uses to execute the program. Since this was compiled as an applet we will need to create an HTML document and insert a reference, like the one below, to the Hello.class code before the applet will run. (HTML is covered in more depth later in the tutorial. For now, just copy the code required to run your applet in the browser.)

  Applet execution Window

Notice the Letters in Hello World are

Times New Roman Font,

Bold,

red and

36 points in size

 

The applet running in this window
is executing the Hello.Class
intermediate code at the web site
where you found this tutorial.

If you want to execute the code
you have compiled on your machine
you will have to create an HTML page
on your local drive with a reference to
the Hello.class file .

If you would like to see your Applet run now, copy the following HTML code to any text editor, save it as Hello.htm in the same directory as your Hello.class file and then open Hello.htm in your favorite browser.

<html>
<head>
<title>Applet Page</title>
</head>
<body>
<p>This is your Applet!</p>
<p><applet code="Hello.class" width="210" height="128"></applet></p>
</body>
</html>

You will see the Applet execute if you have a Java enabled browser.

Go to the next topic: Hello World Application

Back to the Table of Contents