Tuesday, June 26, 2007

Doja Development in Netbeans

Back in October 2006 I wrote a three part post (one, two and three) on how to develop mobile applications for Japanese phones using Netbeans as IDE. When I say Japanese phones I refer to phones provided by the three major cellular network providers in Japan: KDDI, Softbank and NTTDoCoMo.

Recently I was assigned a new project that requires the implementation of a Doja IApplication for the 903i release of NTTDoCoMo phones. Since these phones support Doja-5.0 profile I started to add support for it into my Netbeans installation and in the way I decided also to upgrade to Java-6u1 and Netbeans 5.51.

After some time setting all up I can say it was worth the effort and this new set up is cleaner and more easy than my previous one. For those interested here is my set up.


If you want to upgrade to Java-6u1 I strongly recommend you to uninstall all other instances of Java on your system. I had a lot of rare problems until I removed the previous Java 1.4.2 from my system. Uninstall Netbeans and the mobility pack if you have it.

Also uninstall all previous Doja toolkits you may have as they are all included in the Doja-5.0 toolkit.

Download and install Java SDK, Netbeans, Netbeans Mobility Pack and the Doja Toolkit-5.0 in that order. Here are the links:

  • Java Development Platform 6u1. link

  • Netbeans and Mobility pack link

  • Doja Toolkit 5.0. link

Doja Netbeans Pack

Once you have all installed you can download my Doja Netbeans pack (doja-netbeans.zip) that contains some needed configuration files and a single ant task that we will use to generate the JAM file and a nice download html file that are needed for deploying IApplications.

To use the Doja Netbeans Pack you need to do some manual work. First uncompress the zip file and you will see three files:

  • Doja.xml - Contains Doja profile configurations.

  • build.xml - Build script that creates JAM and HTML files for IAppli deployment

  • doja-ant-tasks.jar - My custom ant task used by the build script to create the JAM and HTML files

Adding the Doja Emulator Platform to Netbeans

Make sure Netbeans is not running and copy the Doja.xml configuration file inside your users .netbeans platform configuration directory. This directory is usually:

c:\Document and Settings\username\.netbeans\5.5.1\config\Services\Platforms\org-netbeans-api-java-Platform\

After you have copied the Doja.xml file to the correct directory you must open it and edit the platform home element. Simply look at the top of the file the xml tag and change the home="C:\install_path\iDKDoja5.0" with the directory were you installed the Doja toolkit. If you choose default installation when installing the Doja toolkit then you should put home="C:\iDKDoja5.0".

If everything is ok then when you start Netbeans and create a new Mobile Application you should be able to select the NTT Doja Emulator Platform and one of the FOMA devices. Each device uses an specific Doja Profile version:

  • FOMA904i - Doja-5.0

  • FOMA903i - Doja-5.0

  • FOMA902i - Doja-4.1

  • FOMA901i - Doja-4.0

  • FOMA900i - Doja-3.5

  • FOMA506i - Doja-3.0

  • FOMA505i - Doja-3.0

You must choose the device depending on what Doja profile the device you are developing for supports. A list of devices and the Doja version they support is available at NTTDoCoMo home page here .

If you don't see the Mobile Application option when creating a new project make sure you have installed the Netbeans Mobility Pack correctly. If you are able to create Mobile Application projects but you don't get the NTT Doja emulator platform make sure you have copied the Doja.xml file in the correct place and edited the home property correctly.
Setting up the Doja ant task

Create a new Mobile Application using Netbeans and once created replace the project's build.xml file with the one that came with the Doja Netbeans pack. This modified build.xml script should look like:

<?xml version="1.0" encoding="UTF-8"?>
<project name="" default="jar" basedir=".">
<description>Builds, tests, and runs the project .</description>
<import file="nbproject/build-impl.xml"/>

<property name="jam.AppClass" value="HelloNtt" />
<property name="jam.AppName" value="HelloNtt" />
<property name="jam.PackageURL" value="http://test.mydomain.org" />
<property name="jam.Network" value="http" />
<property name="jam.SPSize" value="1024" />

<taskdef name="jamwriter" classname="jp.doja.ant.JamTask">
<pathelement location="C:\path_to_jar\doja-ant-tasks.jar"/>

<target name="post-jar">
<jamwriter />

<target name="run" depends="init,jar">
<exec executable="${platform.home}/bin/doja.exe" dir="${dist.dir}">
<arg value="-i" />
<arg value="${name}.jam" />

<target name="post-clean">
<delete file="${dist.dir}/${name}.jam"/>

For this build script to work you must search for the tag inside the jamwriter taskdef and modify the location to point to the doja-ant-tasks.jar file that came with the Doja Netbeans Pack. Simply said modify the "C:\path_to_jar\doja-ant-tasks.jar" line to point to the place that file is located in your computer.

This custom task will create the needed JAM descriptor file and an HTML file you can use to deploy your IApplis. The most relevant entries that go inside the JAM file are already on the build.xml script:

<property name="jam.AppClass" value="HelloNtt" />
<property name="jam.AppName" value="HelloNtt" />
<property name="jam.PackageURL" value="http://test.mydomain.org" />
<property name="jam.Network" value="http" />
<property name="jam.SPSize" value="1024" />

You can add as many entries as you like by simply creating a new tag with the name starting with "jam." followed by the actual property name and the value set to the entry value. If you do not understand what the JAM descriptor file is or what properties are available refer to this tutorial at the Doja Developers Network. Again the most used ones are the ones presented above.
Final Remarks

Well we are finished. Now we can create Doja IAppli's easily in Netbeans taking advantage of all the tools Netbeans has to offer for that purpose. We get automatic preverification, several levels of ofuscation, packaging, JAM and download HTML files creation (via custom ant task) and most important device fragmentation control. Actually the only reason I like to use Netbeans for J2ME/Doja development rather than using the native Doja Toolkit or Eclipse is because Netbeans has a nice preprocessor that makes it easy to deal with the device fragmentation problem.

To test this setup you can refer to my previous blog post on the topic (see links at the beginning of this post).

Saturday, June 16, 2007

Skype Linux is comming fast!!

When the new release of Skype was released with Feisty Fawn binary packages and a repository I simply jumped in and installed Skype on my system using those repositories.

Happy with the new release I fired up Skype to be greeted with my old friend, the ***glibc detected *** bug.

Sad for the step back I started to read the FAQ on how to report a bug and when I was about to submit the report the little apt-get update icon appeared on my systray. I clicked and saw that a new version of Skype was available to install... that was fast!! . A couple of clicks and I had the new release installed and the what is better the bug was gone!. Skype runs just perfect and looks great on my laptop now. At this speed I expect video support to be here very soon.