Eclipse J2ME How-To

This How-To is based on my experience with the Eclipse IDE on Linux, but will probably also be useful for Windows users. The How-To targets people who know their way around Linux, you should at least be able to run an installer from commandline.

Required software

A working J2SE SDK is required. The latest version at this time is 1.4.2_04. If you do not already have a working installation, downloads are available from http://java.sun.com/j2se/1.4.2/download.html.

Beware that some of these downloads include the NetBeans IDE, which is not what you want. Make sure you get the SDK from the J2SE section.

You will need to download one or more of the Wireless Toolkits from Sun's website. Currently two versions exist. Download version 1.x if you want to develop MIDP 1.0 applications. Get version 2.x if you want to develop MIDP version 2.0 applications. The toolkits are available from: http://java.sun.com/products/j2mewtoolkit/

Get the Eclipse IDE from http://www.eclipse.org/downloads/. Several packages exist here, get the latest package named eclipse-SDK... , version 3.0M. At the time of writing the latest package is the M9 release. If you are running Linux you should get the GTK package if you are running the Gnome desktop system (default in Redhat and Fedora) or the Motif package if you are running the KDE desktop system (default in Suse Linux).

You will need a J2ME plugin for Eclipse in order to develop J2ME applications. My choice is the Eclipseme plugin. Get the latest relase from http://eclipseme.sourceforge.net/. Check the requirements to make sure the plugin supports the Eclipse version you downloaded.

Installation

Start off by installing the J2SE SDK if needed. This will require root privileges on Linux and Administrator privileges on Win 2000/XP.

Then install the wireless toolkit(s) from Sun. To avoid problems, I strongly suggest that you install these as regular user.

Eclipse does not include an installer on Linux. Just unzip it to the directory to which you want to install it.

Unzip the eclipsme plugin to the "plugins" directory found in the Eclipse installation directory.

That's it! All necessary packages should now be installed.

Configuration

Some configuration may be needed on Linux to make Eclipse work. Open a terminal and check if Java is available with the command:

java -version

If you get a "command not found" error you will need to set a variable in your system environment, else you can start using Eclipse immediately and go straight to configuration of the Eclipsme plugin. To set the environment variable you need to do the following:

If you installed Java with the RPM package from Sun, your Java installation will be in a directory similar to: /usr/java/j2sdk1.4.2_04. The JAVA_HOME variable should be set to this directory. This is done by adding the following line to the .bash_profile file in your home directory.

export JAVA_HOME=/usr/java/j2sdk1.4.2_04

You will need to log out for this change to take effect. When you log back in, Eclipse should be working fine.

Finally you need to configure the Eclipsme plugin through the menus of Eclipse. Intructions are available from http://eclipseme.sourceforge.net/.

Problems

You may develop JABWT applications with Eclipse and the Eclipseme plugin. There is however a bug when running the J2ME emulator from within Eclipse if you use external jar-files in your MIDlet. The external libraries are not included on the commandline used to start the emulator. My work-around was to have Eclipse do the compilation and packaging of MIDlets, but run the emulator manually from commandline. I have filed a bug to the Eclipseme developer, hopefully this problem will be resolved in the near future.

Also remember to edit the jad file for your MIDlet suite, especially the section with the list of MIDlets. If this is omitted, you will probably crash the mobile device to wich you want to install your application to. If you enter the wrong classname for the MIDlet, the mobile device will not be able to start the application, but the installation will probably go fine.



This page was last updated 14. Jul. 2006

Comments and feedback are highly appreciated.

You can reach me at: klings (at) nowires (dot) org

Most pages on this site, in particular the How-To's, are available primarily for archival purposes.

Klings.NoWires.How-To()

Home

J2ME CDC CLDC MIDP 1.0 MIDP 2.0 MIDlets JABWT

Bluetooth

BTBrowser BTBenchmark KlingsLib

Code Structure Inquiry Service
search
RFCOMM Pitfalls Service record usage Service record manipulation

Devices Developers

Tools Rococo IDEs WTK NDS Antenna

How-To Bluez OBEX Eclipse NetBeans JBuilder WAP

About me