How to Write a Java MIDlet Program for Wireless Cellular Phones and Handheld PDAs Using J2ME

I used the following article to help me figure out — finally — how to get a Java program on a mobile phone.  I’ve done it several times with Visual Basic, but never with Java.

 

Quoted from http://www.codeguru.com/cpp/w-p/ce/networking/article.php/c7911/:

 

CodeGuru: How to Write a Java MIDlet Program for Wireless Cellular Phones and Handheld PDAs Using J2ME

 


How to Write a Java MIDlet Program for Wireless Cellular Phones and Handheld PDAs Using J2ME

 

1.  The first step was already done, I had Java on my computer already.

2.   Install
Java 2 Platform, Micro Edition Wireless Tool Kit.  I did a search on that, and ended up at http://java.sun.com/products/sjwtoolkit/ and I read and followed the article until I got to Downloads, and ended up at http://java.sun.com/products/sjwtoolkit/download.html.  I downloaded the Windows version, since we run Windows XP and installed it per directions.

 

3.  Next, I copied his code into my own file, SampleMidlet.java.   A few of the lines were too long and did not paste right, so I had to fix them.

 

4.  I then ran the Wireless Toolkit as his directions show.

 

5.  Next I copied my SampleMidlet.java into the src file as he indicated.

6.  Then run the Wireless Toolkit again and Build your project (you can leave it open).

 

7.  Then run your project.  You’ll get a phone emulator with your new project on it. 

 

8.  The last step of the CodeGuru’s directions to use, is to build the package. Click on Project, Package, Create Package.

 

Here’s where directions differ, since he is writing about the Palm.  I have a Cingular 8525 (or AT&T 8525), and want to use the Intent Midlet manager.

 

When you build your package, you get two files in your Bin file.  You really only need one, the SampleProject.java file.

 

9.  Get that file onto your phone, anyway you like.  You can either email it as a file attachment, or copy and paste it using ActiveSync. 

 

10.  Find the java file that you just saved on your mobile phone using File Explorer, and double click on it.  MidLet Manager will open and ask if you want to install the midlet. Click on Yes.   Then double click on SampleProject that you just installed, and the program will execute.