LUG Sponsors

Home‎ > ‎Tutorials‎ > ‎

Mini-HowTo: Setup a Development Environment for J2ME Applications in Ubuntu 10.04

J2ME (Java 2 Micro Edition) is currently used as an API by many electronic devices. Most notably, nearly all "dumb"-phones are using it, and it has a relatively well-defined standard making cross-platform application development fairly easy. The smartphone market is fully aware of the massive availability of J2ME applications, and smartphone emulators for J2ME applications either exist or are under development.
The ability to reach such a broad market makes J2ME development something I am very interested in, so I went about learning how to do it! First, I needed to set up a development environment:

System: 1.6 Ghz Pentium Core Duo, 512 Mb RAM, Ubuntu 10.04

1. Install Ubuntu packages necessary for Java development:

$sudo apt-get install gcj sun-java6-jdk sun-java6-jre

gcj: Gnu Java Compiler - This will reach out for several packages needed to compile Java Apps

sun-java6-*: There is an Open Java SDK available, but it does not build projects created with the Sun Wireless Toolkit reliably. Stick with the Sun JDK and just release your code as you see fit!

2. Install the Sun Wireless Toolit:
UNFORTUNATELY - Sun (spoken Oracle) has not released Java ME SDK 3.0 for Linux yet. The Sun Wireless Toolkit was enveloped by the SDK in version 3.0. For now, we must install the Wireless Toolkit (WTK) manually.

$ wget https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site...

This will download the binary file necessary for installation. You can view the Oracle page for research / links here.

Once the file has been downloaded, you must change its permissions to allow execution:

$chmod +x ./sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh

Now, you need to do some research so you know what to tell the installer. First, we need to know where our JDK is located. Start looking in:

/usr/lib/jvm

There will be several directories and sim-links. In my installation, the sim-link java-6-sun pointed to the right location for the JDK. Next, we install the WTK:

$./sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh

After the license agreement, you will be prompted to enter a JDK location if the installer could not find it. In my installation, I had to manually define the JDK location:

/usr/lib/jvm/java-6-sun/bin

It is very important to carry the path all the way to the */bin directory. The next few questions are very straight forward.

3. Develop:
Once the WTK installation is complete, you can run */WTK2.5.2/bin/ktoolbar to create, build, and package your J2ME apps.
The WTK comes with some examples to help show the capabilities and uses of the WTK build process and emulator.
When a project is created, it is automagically saved in your "workspace." The WTK pre-defined the workspace path to:

~/j2mewtk/2.5.2/apps

Each project's root folder contains a */src folder for your source code.

Sun (Oracle) has quite a bit of reference material for getting started with wireless development. Here is a place to start!

-J