NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.

Java ME

From Texas Instruments Wiki
Jump to: navigation, search


Java MicroEdition, also known as Java ME, was developed to bring Java to cell phones and other portable media devices. More information is available on Sun's website at

phoneME Feature is an open source project that provides Java ME's CLDC capabilities. It is available at phoneMe can be built for Linux, Windows as well as Windows Mobile and CE.

There are a number of other open source and clean room options available for ARM9, but below are some simple instructions to get a Java ME application running on a DaVinci EVM.

Getting phoneME Feature to run on DM355

The following instructions assume the use of Montavista Linux 4.0.1, RHEL4 Host and DM355 DVSDK. A similar procedure should also work for DM6446.

Setting up your environment

  1. Download and install phoneME Feature from
  2. Download and install Java 2 Platform, SE Development Kit 1.4.2 from
  3. Detailed instructions can be found at:
  4. Create a file,, on your host, then copy and paste the following into it. Then edit your paths appropriately (first 3 lines), followed by: host# source

<syntaxhighlight lang='bash'>export MEHOME=/home/user/workdir/phoneme_feature export JDK_DIR=/usr/java/j2sdk1.4.2_17 export MONTAVISTA=/opt/montavista/pro/devkit/arm/v5t_le/armv5tl-montavista-linuxeabi export PATH=$PATH:$JDK_DIR/bin export BuildDir=$MEHOME/javacall-com/configuration/phoneMEFeature/win32_x86 export JAVACALL_DIR=$MEHOME/javacall export JAVACALL_PROJECT_DIR=$MEHOME/javacall-com export JAVACALL_OUTPUT_DIR=$MEHOME/javacall-com export PCSL_OUTPUT_DIR=$MEHOME/output/pcsl export PCSL_PLATFORM=linux_arm_gcc export NETWORK_MODULE=bsd/generic export ENABLE_PCSL=true export ENABLE_ISOLATES=true export JVMWorkSpace=$MEHOME/cldc export JVMBuildSpace=$MEHOME/output/cldc export MIDP_OUTPUT_DIR=$MEHOME/output/midp export CLDC_DIST_DIR=$MEHOME/output/cldc/linux_arm/dist export TOOLS_DIR=$MEHOME/tools export TARGET_CPU=arm export USE_MULTIPLE_ISOLATES=true</syntaxhighlight>

Compiling phoneME Feature for DM355

  1. Start by: host# cd /phoneme_feature/pcsl
  3. Then: host# cd /phoneme_feature/cldc/build/linux_arm
  5. Then: host# cd /phoneme_feature/midp/build/linux_fb_gcc

Running a test

  1. Enable the following two device drivers by typing: host# make menuconfig in LSP_dir/montavista/pro/devkit/lsp/ti-davinci
    1. Device Drivers -> Character Devices -> Support for console on virtual terminal
    2. Device Drivers -> Graphics Support -> Console display driver support -> Framebuffer Console support
  2. Rebuild the kernel via: host# make uImage and copy to /tftpboot
  3. Connect an LCD via composite cable and USB keyboard to the EVM
  4. Use standard TFTP/NFS bootargs as given in the Getting Started Guide, but remove "console=ttyS0,115200n8" and boot the EVM
  5. Copy the /phoneme_feature/output/midp directory (on host) to /opt/java (target file system)
  6. From the serial terminal, type: target# ln -s /dev/fb/0 /dev/fb0
  7. Then type: target# ln -s /dev/console /dev/tty0
  8. For a quick test, do: target# cd /opt/java/midp/bin/arm and type: target# ./usertest

Running a sample application

  1. Download and install JDK 1.5.0 from
  2. Download and install Sun Java Wireless Toolkit 2.5.2 (or later) for CLDC from
  3. Run host# ./ktoolbar in WTK2.5.2/bin
  4. Click New Project, then enter: Project Name: Hello, Class name: my.project.hello.Hello
    1. This will create several directories including a src dir
    2. Add "Hello World" code as in the src directory (Several examples are available online)
  5. Then click Build and Run (this will verify that the MIDlet runs on an emulator)
  6. Create Hello.jar by clicking Project->Package->Create Package
  7. Copy Hello.jad and Hello.jar from your_project_dir/bin on your host to your target file system: target/opt/java/midp/bin/arm
  8. Install the MIDlet by typing the following on the terminal: target# ./installMidlet Hello.jad
  9. Verify MIDlet installed via: target# ./ and note the suite # of your MIDlet
  10. Run your MIDlet via: target# ./runMidlet # (where # is your suite number)
  11. Note: F1 will act as the left menu button (usually to quit the MIDlet), F2 will act as the right menu button (usually to open the MIDlet's menu)
  12. The MIDlet will now be displayed to the LCD and the keyboard can be used to interact with the MIDlet

Java SE Embedded

Sun currently offers Java SE for ARM (available at Unfortunately, the currently available EABI binaries require glibc 2.4.

By default, DM355 and DM6446 (Montavista Linux) use glibc 2.3.x. To determine which glibc version you use, try:

target# rpm -qa glibc

If this does not work, try:

target# ls -al /lib/libc*

On OMAP3 (or if you upgrade your glibc), you should be able to evaluate Java SE Embedded. Download the EABI / glibc 2.4 / soft float, and copy the directory to your target file system. To test, try:

target# /opt/java_se/java -version

On your host, compile a Java program, say, then copy the resulting HelloWorld.class to your target. Then:

target# /opt/java_se/java HelloWorld