What is J2ME?
J2ME stands for Java 2, Micro Edition. It is a stripped-down version of Java targeted at devices which have limited processing power and storage capabilities and intermittent or fairly low-bandwidth network connections. These include mobile phones, pagers,wireless devices and set-top boxes among others.
A Sample Wireless Stack would consist of:
Profiles
Configurations
Java Virtual Machines
Host Operating System
What is a J2ME Configuration?
A configuration defines the minimum Java technology that an application developer can expect on a broad range of implementing devices.
J2ME Connected, Limited Device Configuration CLDC
specifies the Java environment for mobile phone, pager and wireless devices
CLDC devices are usually wireless
160 - 512k of memory available for Java
typically has limited power or battery operated
network connectivity, often wireless, intermittent, low-bandwidth 9600bps or less
J2ME Connected Device Configuration CDC
What is a J2ME Profile?
A specification layer above the configuration which describes the Java configuration for a specific vertical market or device type.
J2ME Profiles
J2ME Mobile Information Device Profile MIDP
this is the application environment for wireless devices based on the CLDC
contains classes for user interface, storage and networking
J2ME Foundation Profile, Personal Basis, Personal and RMI profiles
these are profiles for devices based on the CDC, which are not addressed in this tutorial
Virtual Machines
The CLDC and the CDC each require their own virtual machine because of their different memory and display capabilities. The CLDC virtual machine is far smaller than that required by the CDC and supports less features. The virtual machine for the CLDC is called the Kilo Virtual Machine KVM and the virtual machine for the CDC is called the CVM
Tools
PC MacOS X Linux
First make sure that you have the Java 2 SDK, Standard Edition J2SE SDK, version 1.4.2 or later. This is essential for development. If you haven't installed it, download it and install it from here http://java.sun.com/j2se/downloads/.
You absolutely MUST have the J2SE SDK installed before you install the Java Wireless Toolkit as you will be needing the tools it contains such as javac to compile and run your MIDlets.
Then download the J2ME Wireless Toolkit WTK which is available free from Sun here - http://java.sun.com/products/j2mewtoo.... I'm going to assume that you'll be installing this in the C:\j2mewtk\ directory, if you use another directory, just modify the paths accordingly.
Paths
Java needs to know where all your files are, so we need to add the location of the Java binaries to the system path.
Windows 95/98
Go to Start-Run. Type in command. Then type
SET PATH=%PATH%;C:\j2mewtk\bin
You should also edit your C:\autoexec.bat file to include this line, so you don't have to enter it every single time you restart your computer. After you've done this, you should be able to run the tools included in the Java Wireless Toolkit from any directory on your system.
Windows 2000/XP
Go to Control Panel - System.
Click on the Advanced Tab
Click on the Environment Variables button
Double-click the PATH variable in the System variables box
At the end of the Variable value field, add the path to your J2ME WTK installation - for me this is something like C:\j2mewtk
If you had to install the J2SE SDK too, it's a good idea to add the path for that - for me this is C:\j2sdk1.4.2_03 and C:\j2sdk1.4.2_03\bin. Here's what my screen looked like.
A good way to test if this worked is to type the preverify command without any arguments in the command line. You should see something like this on your screen.
C:\ preverify
Usage: PREVERIFY.EXE [options] classnames|dirnames ...
where options include:
-classpath
Directories in which to look for classes
-d Directory in which output is written
@ Read command line arguments from a text file.