Hello World App
This tutorial will help you create the infamous Hello World app in the version of a stand-alone GUI app.
I have attached a copy of the java and the class file.
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.awt.*;
import java.awt.event.*;
import java.applet.*;
public class HelloWorldApp extends Frame implements
ActionListener {
private Image im ;
Button button = new Button("Exit");
Panel panel = new Panel();
Label label = new Label("Hello World!");
public void start(String args) {
setLayout(new FlowLayout(FlowLayout.CENTER));
panel.setLayout(new FlowLayout(FlowLayout.CENTER,2,2));
panel.add(button);
panel.add(label);
add("North", panel);
button.addActionListener(this);
validate();
}
public void actionPerformed(ActionEvent event) {
String str = event.getActionCommand();
if (str == "Exit")
System.exit(0);
}
public static void main (String args[]){
HelloWorldApp testApp = new HelloWorldApp();
testApp.start("a");
testApp.setSize(240, 280);
testApp.validate();
testApp.show();
}
}Save this file as HelloWorldApp.java in the c:\jdk1.3.1_03\source folder. (Make sure it didn't get called HelloWorldApp.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 HelloWorldApp.java
Hit Enter.
If compiling is successfull the command line will return without any errors like above.
Next, type the following line.
cd ..
cd classes
java HelloWorldApp
If successfull you will see a new window open like below.
Transferring the Hello World App to the Zaurus
Next, using windows explorer, open the c:\jdk1.3.1_03\classes folder and copy the file into your 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.)
On the Zaurus open a Termal shell on the Zaurus.
Enter the following.
cd Documents/application/octet-stream
evm HelloWorldApp
Then hit the return key
If successful you should see the following.
(This isn't an actual screen print from the Zaurus, but it will be similar.)