For this project, you are required to design and create an HTML document (also referred to as a Web page), in which certain basic HTML elements are incorporated. Your HTML document must also link to several Java applets, some of which you will compile yourself from the code provided, and some you will obtain from online sources and simply link to in your HTML document.

In addition, you will input, compile, and test a simple Java application. Unlike Java Applets, which are linked and run from within HTML files, Java applications run freestanding, and can be run from the DOS Command Line.

This project is designed to familiarize you with Java tools and processes, including editing, compiling, and viewing applets and applications, as well as with the methods for using Java Applets in Web documents.

The project does not aim to teach you to program in Java, which is beyond the scope of this course, but rather to familiarize you with the use of the Java environment and tools, in preparation for future courses in programming.

There are two related learning objectives involved:

  • Creating HTML documents.
  • Using Java Development Kit tools (primarily the compiler and appletviewer) to edit, compile, and test Java Applets (which will then be run from your HTML pages) and Applications (which can be run from the Command Prompt).

Your Web page design should use an effective background image or pattern, and various colours, text sizes, and images to create a visually effective design. Your Web page should also include your name, the course name and number, an email link to you, and links to the required Java Applets and navigation links to facilitate easy movement within the pages.

The project has two parts:

  • Part 1Applets you will create from the code provided.
  • Part 2A sample downloadable Applet, which you will obtain from an online source. These usually include ready-to-run Class files, as well as the HTML code that launches them.

The recommended procedure for completing this project is as follows:

  • Review all the project instructions and study the JAVA PROJECT DEMO. ** Note that the applets in the demo project are slightly different from those that will be produced when you input and compile the code supplied below.
  • Work through the HTML tutorials, and study the HTML code in the sample project pages until you are confident you can create your own HTML pages to package the Java Applets.
  • Build the HTML pages (without the Java Applet links for now), and test them for navigation and other basic functionality.
  • Download and install the current active version of the Java Development Kit from and set your classpath as per the detailed instructions provided. **NOTE: Do not use older versions OR unreleased Beta versions of the JDK as this will result in file compatibility issues with your tutors version of the software.
  • Input, compile, and test the Part 1 Applets, and link them to your HTML pages.
  • Download and test the Part 2 sample Applet of your choice, then add the HTML code to your Project pages.
  • Test the entire project, compress it with WinZip, and submit it to your tutor.

Again, it is very important that you carefully review the JAVA PROJECT DEMO to see an example of what the finished project may look like, although you are encouraged to create an original look and feel for your own pages. The applet results seen in Part 1 of the Project Demo must be different from those you will create for your page; i.e., you must compile the code yourself, and not simply copy the compiled class files from the sample.

There are extensive links for tutorials, software tools, and other useful resources at the Virtual Helpdesk. Check both the Course Tools and the Java Helpsections. Links to other required and useful resources can be found below.


  • Download and install the Java Development Kit (version 1.4.2 or higher) by following the instructions on the Virtual Helpdesk PageGetting Started Java (JDK).
  • The downloaded file is the Java 2 SDK installer, and is named j2sdk-1_4_2_x-windows-i586.exe (assuming a Windows download). After running the installer file (by double clicking on it), you can view the installed components in the folder c:j2sdk1.4.2_ on your hard disk. To recover disk space, you can delete the installer file after you have completed the installation. Note, version number or x pertains to the latest version number available from Sun Microsystems, and therefore it may vary.
  • Set your path to the JDK using the instructions from the Virtual Helpdesk Java Help files.
  • Download and install the Programmers File Editor

(NOTE: This is optional. Java code and HTML may also be input and edited using Notepad.)

Functioning Java Class Files for PART 2 may be obtained online from Sun Microsystems Applets page.


You are provided with Java code for two Java applets below. In each case, the text should be typed into either WordPad or a Programmers File Editor, then saved as named, compiled using the javac compiler included in your JDK, and tested using the appletviewer. Finally, the working applets should be linked to Part 1 of your HTML document.

Again, we must stress that you are not expected to learn how to program in Java at this stage, only to develop some familiarity with the tools and processes involved.
import java.awt.*;
import java.applet.Applet;
public class Triangle extends Applet {
public void paint (Graphics g){
int bottomX=80;
int bottomY=200;
int base=100;
int height=100;
g.drawLine(bottomX+base/2,bottomY-height, bottomX,bottomY);
import java.awt.*;
import java.applet.*;
public class Oval extends Applet {
public void paint (Graphics g) {
Color c=new Color(20,120,160);

Notes on using MS-DOS to run the compiler and appletviewer

The program that compiles your Java code files, creating Applets (class files) which can then be run from an HTML document, is called javac.exe, and is found in the bin folder of your JDK directory. This compiler must be run from an MS-DOS command line, accessible in Windows by selecting Start, Run, and typing CMD.

DOS is a command line interface, which means that you must type in commands to run the program. In this exercise, there are two basic forms these commands will take:

  • Commands to reach the desired location in the file structure; for example, CD/Python23.
  • Commands to compile a Java code document. Once input as Java code files (*.java), applets must be compiled into class files before they can be run. By setting the path for the compiler as instructed above, you make it easier for DOS to locate the compiler and/or the Java code files; however, the following will demonstrate how the Java compiler can be used, even if the path has not been set. The DOS command to compile a Java program consists of the command to run the compiler (javac), plus the name of the java file to be compiled. For example, if the file was saved in the bin folder of the JDK directory, it could be compiled from the DOS command line by following the steps below. In the illustration, command line prompts are displayed in bold, the command to be entered is in italics, and a descriptive comment is also included in parentheses. This illustration is based upon the assumption that the JDK version is 1.4.2, and that the Java file has been saved into the bin folder of the JDK directory.
c:windows> cd (Changes the active directory to the root, or main directory)

c:> cd j2sdk1.4.2.xbin (changes the active directory to the jdk bin folder; note that version numbers in the jdk folder name may vary)
c:j2sdk1.4.2.xbin> javac (runs the compiler on the desired code file)

Once compiled and linked to an HTML file, the applets can be viewed using either a browser or the Appletviewer.

To link an applet to an HTML page, insert a tag like this into the HTML:

< applet code=“Hello.class“ width=400 height=400 >
< /applet>

You can substitute other Applet (class) names as required.

To view the applet, either load the html page into your browser (e.g., Firefox, Internet Explorer, or other), or run the Appletviewer from the DOS command line. This can be done by switching the active directory to the jdkbin folder, then entering the command:

appletviewer Hello.htm

Again, you will need to substitute filenames as required.


Obtain ONE of the sample applets from here, or any other source for free Java applets you may wish to use. Test the applet, and link it to Part 2 of your HTML page(s).

Functioning Java Class Files for PART 2 may be obtained online from here.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.