Thursday, February 18, 2021

J2ME Jumpstart Tutorial With Wireless Toolkit 2.5.2

J2ME Jumpstart Tutorial With Wireless Toolkit 2.5.2


Introduction


I am late by 20 years, but I believe there are still some values with this old software.

In Java 1.2, Java split into 3 categories, J2SE, J2EE and J2ME. J2SE (Standard Edition) is the original Java from Java 1.1. J2EE (Enterprise Edition) is for building server side web application. J2ME (Micro Edition) is a subset of J2SE, with a small footprint to run on mobile and other microprocessors platform.

J2ME was designed to run on low memory and storage, 512k ram or less. In real implementation J2ME vm can runs on 8k ram (as stated in squawk documentation).

J2ME has a configuration base and a profile (J2ME=Configuration+Profile). There are 2 configurations in J2ME, CLDC and CDC. CLDC (Connected Limited Device Configuration) with a smaller footprint. There are more profiles available, the most common is MIDP.

This tutorial focus on CLDC+MIDP.

Software you need to compile MIDP program


1. Java jdk compiler (Java SE)
2. Sun wireless toolkit (which includes CLDC configuration, MIDP profile, preverifier and emulator).

The process to compile MIDP program:
1. compile with java compiler.
2. preverify with the preverifier.
3. package into j2me package.

Sun wireless toolkit 2.5.2


The Sun wireless toolkit (WTK 2.5.2) is a very old software. It might not runs on your system. I have tried on macOS (High Sierra) and Linux (Raspberry Pi Desktop OS), encounter some issues but there are workaround for it.

Download from the Oracle website https://www.oracle.com/java/technologies/java-archive-downloads-javame-downloads.html. Choose your OS platform. There is no macOS platform for WTK 2.5.2, just the Linux version to install.

Install (macOS)
$ chmod +x sun_java_wireless_toolkit_xxx_.bin.sh
$ ./sun_java_wireless_toolkit_xxx_.bin.sh

Read the license. Do you agree to the above license terms? [yes or no] yes
Specify a path to Java interpreter directory: [ /Library/Java/Home ]
(I use /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home )
Directory to install the toolkit: /usr/local/wtk-2.5.2

Test the installation
$ cd /usr/local/wtk-2.5.2
$ bin/ktoolbar
⇒ error
Mac/ktools.properties (no such file)

$ cp lib/Linux/ktools.properties lib/Mac/ktools.properties
$ bin/ktoolbar


to be continue... next will talk about how to write and compile a j2me midp program.

No comments: