Exercise 4: Java Applet - Hello World
For a detailed Java information see
The Java Tutorial.
Write a Java applet which prints "Hello World!" in a Netscape browser.
- First move into your web directory.
$ cd www
- Create a file called HelloWorld.java and type in the program given in
class.
$ vi HelloWorld.java
- Compile the source file.
$ javac HelloWorld.java
- Create the HTML file needed to display the applet.
$ vi HelloWorld.html
HelloWorld.html will look like the following:
<HTML>
<HEAD>
<TITLE>The Hello World Applet</TITLE>
</HEAD>
<BODY>
<APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25>
</APPLET>
</BODY>
</HTML>
- To check your results open the HelloWorld.html file in your browser.
Exercise 4 is due Thursday March 2. We will look for the HelloWorld.java,
HelloWorld.class, and HelloWorld.html files in your www directory.