Hello World Applet

This tutorial will help you create the infamous Hello World Applet inside an html file.

wpe13.jpg (22977 bytes)

I have attached a copy of the java and the class file.

HelloWorldApplet.java

HelloWorldApplet.class

To begin, you will need to install the latest JDK. You can find the latest version at java.sun.com. (I am using JDK 1.3.1_03.)

After install is complete reboot your system.

Create a folder in your c:\jdk1.3.1_03 folder called source.  (This is where you will keep all your .java files)

Create a folder in your c:\jdk1.3.1_03 folder called classes.  (This is where you will keep all your compiles .class files)

Open notepad.

Enter the following

import java.applet.Applet;
import java.awt.Graphics;

public class HelloWorldApplet extends Applet {
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}

Save this file as HelloWorldApplet.java in the c:\jdk1.3.1_03\source folder.  (Make sure it didn't get called HelloWorldApplet.java.txt)

Open a command prompt and type the following lines hitting enter after each line.

path = c:\jdk1.3.1_03\bin

cd \

cd jdk1.3.1_03\source

javac -d c:\jdk1.3.1_03\classes HelloWorldApplet.java

Hit Enter.

wpe12.jpg (18051 bytes)

If compiling is successfull the command line will return without any errors like above.

Next, create a new file called HelloWorldApplet.html in the c:\\jdk1.3.1_03\classes folder.

Edit the file and enter the following.

    <applet code=HelloWorldApplet width=240 height=280>
    </applet>

Now find the HelloWorldApplet.html file that you created and open it in your internet browser.

If successfull you will see the following.

wpe14.jpg (22977 bytes)

 

Transferring Hello World to the Zaurus

Next, using windows explorer, open the c:\jdk1.3.1_03\classes folder and copy the file into you documents view of you Qtopia desktop for upload to the Sharp.  Click the Sync All button.

If prompted for a location select Internal Storage.  (You will only be prompted if you have added a CF, SD, or MMC card.)

hello_6.jpg (8383 bytes)

On the Zaurus open a Termal shell on the Zaurus.

hello_7.jpg (20480 bytes)

Enter the following.

cd Documents/application/octet-stream

evm -appletviewer HelloWorldApplet.html

Then hit the return key hello_8.jpg (825 bytes)

wpe17.jpg (8511 bytes)I

If successful you should see the following.

wpe18.jpg (7408 bytes)