Monday, July 6, 2009

Running a simple Java Program in PDA

The PDA which im using is Motorola MC55.I was able to run a simple java program successfully after number of attempts.The things which i have done are

1.Check whether IBM J9 is installed or not.If not install.
2.Write java program in any IDE or notepad in your PC. (SamplePDA.java)

import java.awt.*;
public class SamplePDA {


public static void main (String [] args) {

Frame frame = new Frame ("Main Screen");
Label jl = new Label("My First PDA program..");

frame.add(jl);
frame.setSize(180,80);
frame.setVisible(true);

System.out.println("My First PDA Program..");
}

}

3.Compile the program with JDK1.4 or below.

4.Create a jar file with the class file.(SamplePDA.jar)

5.Create a shortcut file.(sample.lnk)

255#"\Program Files\J9\PPRO10\bin\j9.exe" "-jcl:ppro10" -cp \Sample\SamplePDA.jar SamplePDA


6.Sync the PDA and place the jar in particular location you want.I have placed the SamplePDA.jar in Sample folder.

7.Place the shortcut file(sample.lnk)on the start menu,so that we can execute
application from the start menu.

8.Click the shortcut file(sample.lnk) to run the application.

9.Now you will see a Frame displaying "My First PDA program".

When i tried to use Swing components it shown some error.!!!