J2ME Polish
J2ME Polish 2.4 Documentation
Enough Software

Developing DoJa Applications with J2ME Polish

DoJa is the Japanese J2ME standard created by NTT DoCoMo that also uses CLDC as its foundation. This standard provides similar capabilities as the MIDP platform. J2ME Polish includes a DoJa sample application in ${polish.home}/samples/doja.

Preparations

You can download DoJa emulators from the DoJa Developer Network at http://www.doja-developer.net. There are currently two versions of DoJa for the international market: 1.5 and 2.5. J2ME Polish already includes libraries for both versions. In Japan DoJa 4.0 is the current standard.

In your IDE you need to include either ${polish.home}/import/doja-1.5.jar or ${polish.home}/import/doja-2.5.jar to the classpath of your project.

J2ME Polish Setup

In your build.xml script you might need to specify the doja.home Ant property in case you have not installed the DoJa SDK to either C:\jDKDoJa2.5 or C:\iDK

You then need to adjust your device requirements, so that your application is build for DoJa devices. J2ME Polish includes some virtual devices like the DoJa/os15 or DoJa/os25 ones:

<deviceRequirements>
	<requirement name="Identifier" value="DoJa/os25" />
</deviceRequirements>

Last but not least you need to specify your IApplication class with the <iappli> element inside of the <build> element:

<build>
	<iappli class="tetris.Tetris" />
	<obfuscator name="ProGuard" />
	<!-- ... -->
</build>

You can now build your application and launch the emulator, e.g. by calling ant emulator from the command line. J2ME Polish creates the JAR file without a Manifest and a JAM instead of a JAD descriptor.

Optional JAM Attributes

Several JAM attributes are optional, so you can set them by specifying Ant properties or J2ME Polish variables in your build.xml script. In the following example a scratchpad size of 5,120 bytes (= 5 KB) is reserved:

<variables>
	<variable name="doja.SPsize" value="5120" />
</variables>

The following table lists the available optional attributes.

NameExplanation
doja.AppParam Any startup parameters. These can be retrieved using com.nttdocomo.ui.IApplication.getArgs(). Multiple parameters should be separated by a space.
doja.ConfigurationVer The J2ME configuration version, e.g. CLDC-1.0
doja.ProfileVer The i-mode Java Application runtime environment profile version. e.g. DoJa-1.5oe
doja.SPsize The size of the ScratchPad in bytes.
doja.UseNetwork Set to http for applications which use network functionality.
doja.TargetDevice Set to a model name if the application is targeted to a particular model. Example setting: X430i,Y430i Do not set this key for applications targeted to all models.
doja.LaunchAt To launch the i-mode Java Application automatically at a specified time, set the time here.
doja.AppTrace When the value is set to on, any information output with System.out.println() or System.err.println() will be displayed after the i-Appli is terminated.
doja.DrawArea The size of the i-mode Java Application drawing area, e.g. 120x130
doja.GetUtn Declares that the i-mode Java Application refers to the handset identification code and IC chip information on its SIM or UIM card. Example setting: terminalid,userid This information can be retrieved using the com.nttdocomo.util.Phone.getProperty() method.

Developing DoJa Applications under Linux and Mac OS X

You can build DoJa applications without restrictions under Linux and Mac OS X with J2ME Polish. The DoJa Emulator/SDK is only needed for starting the emulator.

The easiest way is to install the DoJa emulator under Windows and then copy the complete folder into your Unix file system, since the installer won't work together with wine. J2ME Polish will use wine then automatically for executing the emulator under Unix systems. Remember to specify the doja.home Ant property in your build.xml script.

Developing for MIDP and DoJa at the Same Time

Since both MIDP and DoJa use the Connected Limited Device Configuration as their foundation, you can share some code between your DoJa and your MIDP release of your application. You can use the polish.midp and polish.doja preprocessing symbols for distinguishing between your releases. You can exclude a source file for the DoJa release by specifying that it requires an MIDP device, for example. Just use the appropriate #condition preprocessing directive in your Java source file:

//#condition polish.midp

Of course you can also use these symbols in #if directives to branch within an utility class for example:

//#if polish.midp
   // store the data in a record store:
   RecordStore store = RecordStore.openRecordStore( "name", true );
   // ...
//#elif polish.doja
   // store data in the scratch pad:
   Connection con = Connector.open("scratchpad:///0; pos=0", Connector.WRITE );
   // ...
//#endif

Remember that you need to do this for your import statements as well.

back to top