| Developing J2ME CDC compliant application using Creme JVM, Swing and NetBeans IDE for Windows Mobile Devices |
|
|
|
| Written by Felipe J A P Mattosinho |
| Wednesday, 21 July 2010 20:07 |
1. IntroductionHave you ever heard about J2ME CDC? Sun defines two different configurations when programming JAVA J2ME.The first one is called CLDC (Connected Limited Device Configuration), and the other one CDC (Connected Device Configuration). I will skip some details of both configuration, and if you want to know more about it, you can find lots of information on Sun web site. For now, a simple and sufficient explanation for both configurations are: The CLDC is basically what we are used to see in the majority of cell phones. Most of them use this configuration, as the name suggest for "limited" devices. This configuration is intendend to phones with low memory and processing power capacity. In the other hand we have CDC. CDC aims to support smartphones, pdas or cell phones with higher processing power. The feeling that we have programming a CDC application, is almost the same as programming a normal java desktop application. Among several CDC compliant JVMs, this article will show one of them, called CreMe Virtual Machine. This JVM runs under Windows Mobile and its big advantage is the possibility to use Swing for building you GUI. This Virtual Machine was the most stable and reliable that I tested so far(during a project that I was part of), however it is not free and you are allowed to try it for 30 days. Finally, let's move on. I'll show how to set up an evironment for creating mobile applications using Swing and Creme JVM. 2. Setting up the environment & Requirements
NOTE: When installing the Creme JVM remember to connect your phone before. Double click on the executable file and the installation file should take care of everything.If by the end of installation your receive the screen shown in fig 1, you don't need to worry.Just go to the following folder "c:/program files/microsoft activesync/nsicom/" and you should find three files. Copy the .cab file to your phone. Now in your phone, browse to the file, double click it, and the installation will automatically start.After the installation, if you wish, you can delete the cab file.
Now you should perform a last step. Go to the following folder in your pc: "C:\Program Files\NSIcom\CrE-ME V4.12\lib" and copy the file swingall.jar to the following folder in your phone "windows\creme\lib".Without this library on the phone, any application written using Swing will fail to work. Hint: Remember to select the option "show hidden files and folders", in windows explorer. The folder windows in the phone is hidden by default. After installing all of them, let's start setting up a new platform to work with NetBeans.Start your NetBeans. 1-Tools → Java Platforms
2-Click on "Add Platform" , select "Java Me Cdc Platform Emulator" and click "Next".
3 - The next screen asks the path to the folder. You should select the folder where your Creme Developer Kit is installed (the default folder is c:/program files/nsicom/CrE-ME V4.12) and click "Next".
4 - Now select the platform (by default is called:"pJSCP V4.12 B142.190307"). Click on "Finish" .
Your new platform is now added to NetBeans. Now we are ready for our "Hello World" program . On the "Choose Project" panel, select mobility (left panel) and CDC Application (on the right panel called "Project") .Click Next.
Now give a name to your project (e.g "Hello World"). Click Next.
The next screen , asks for a Java Platform
5. Testing the applicationAfter all this steps, let's create a very simple code, to show two different ways to run our application.
jTextField1.setText = "Hello World" as shown in Fig 11.</p> HINT: Creme Virtual Machine, runs very well and stable. However it is easy to realize, that the graphics are bad. My suggestion is to change them whenever possible, by your own graphics (e.g png, gif or jpg images).
4. Testing the software remotelyThe second possibiliy for running and testing your applications, is doing it remotely.
<p class="fign">Fig 1
An application example
Labels , backgrounds and buttons. Graphics can be modified, if you don't like the default grey from Creme
|
| Last Updated on Monday, 26 July 2010 23:38 |


















Comments
Hi Gaz, What type of problems are you finding to deploy it?!
Thanks
Gaz
teu artigo salvou minha pele
ehehehehe
parabéns, otimo tutorial!
I realize that swingall.jar now comes with creme4.12 installation. Besides that I tried all exectly what you said and it worked very well.
RSS feed for comments to this post