Java 1A Practical Class

MIDlets: Programming your mobile


CuteGod Screenshot

Figure 1. The Java Wireless Toolkit


Ever wanted to write programs for your mobile phone? Fancy writing your own application to send an encrypted text messages? Perhaps you'd like to have a stab at writing your own mobile phone game. Writing applications for your mobile phone is a little harder than doing so for the desktop, but by no means impossible. Sun has made it substantially easier with the release of the Java Wireless ToolKit (WTK), provides the programmer with tool to build Java programs for the mobile phone with relative ease. To start, download WTK to your workstation by going to

http://java.sun.com/products/sjwtoolkit/download.html

and clicking on the Download button which can be found towards the bottom of the page under the heading “Download Sun Java Wireless Toolkit 2.5.2_01 for CLDC for Windows and Linux”. Once you've clicked on the Download button, you'll be taken to another page where you can select your operating system (select "Linux"), review the license agreement, and if you're happy, tick the box to say so and click on Continue. Finally, download the file sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh to your computer.

Once this file has downloaded, open up a terminal, make the file you've downloaded executable and then run it

crsid@machine:~> chmod +x sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh
crsid@machine:~> ./sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh

Follow the on-screen instructions until the installation is complete. The part of the installation will tell you how to start the toolkit. For example, if your username is arb33 and you chose to install the toolkit in /home/arb33/WTK2.5.2, then the installer probably suggested you execute the following command:

crsid@machine:~> /home/arb33/WTK2.5.2/bin/ktoolbar

A graphical display should then start which looks somewhat like the one shown in Figure 1, “The Java Wireless Toolkit”. If haven't managed to get this far in the instructions, you should seek the help of a Lecturer or Demonstrator. At this point you have a working toolkit, and you should then be able to follow Sun's tutorial to write your first “Hello, world” application:

http://developers.sun.com/mobility/midp/articles/wtoolkit/

Copyright Alastair R. Beresford and Andrew C. Rice 2008,2009