Thursday Aug 10, 2006

[TIP] Create J2EE project in different J2EE version

When you are creating new Web Application you can specify what J2EE version it will be support in the New Project wizard.
If you don't see J2EE 5 in your IDE it means that you don't have the a server with J2EE 5 support installed.

You can easily specify what J2EE you want in the combobox. Remember: the wizards won't create JAX-RPC webservice/webservice client when your project is J2EE 5... It will generate annotations and the rest of WS 2.0 stuff...

Monday Jul 24, 2006

[TIP] Exclude Tests From Your Jar

When you have a tests in your project you don't want to distribute then with your final jar. It's easy to filter out all the tests in mobility project properties in Mobility Pack. Just check the Exclude Test Sources option. It will filter out \*\*/\*,\*\*/test,\*\*/test/\*\* files. It means all files ending with and all test directories.
When you know how to work with configurations then it's easy to check the option in DefaultConfiguration. All configuration will exclude the tests. Then create a new TestConfiguration for testing purposes and uncheck the Use Values from DefaultConfiguration check box and check the Exclude Test Sources.

Sunday Jun 18, 2006

[TIP] Changing screen size of the emulator

It is easy to change the screen size of the Screen Designer in NetBeans Mobility Pack. Right click on the Screen designer and select Screen Size from the popup menu.
You will see immediatelly the change of screen size in Screen Designer but when you run it on the emulator the emulator screen size is still the same.

To change emulator screen size you'll have to change the properties of the emulator. They are in [EMULATOR_INSTALL_DIR]\\wtklib\\devices\\[EMULATOR_NAME]\\[EMULATOR_NAME].properties There is plenty of properties in this file. We are interested only in following properties. They are distinguished by red and green color on the picture.

  • screen.x
  • screen.y
  • screen.width
  • screen.height

  • screenPaintableRegion.x
  • screenPaintableRegion.y
  • screenPaintableRegion.width
  • screenPaintableRegion.height

It will allow you to change the visible area of the device. The result can look a little bit strange because the display area is still the same only the painting is done into the are that you defined. You can find more informations how to customize or create new device emulator in BasicCustomizationGuide.pdf document in the Wireless Toolkit [WTK] docs directory.
Note: this document isn't distributed with WTK bundled with Mobility Pack

Thursday Jun 15, 2006

Difference between Mobile client To Web Application and J2ME Web Services Client

Difference between these two clients is simple - the JSR 172.

The picture shows how the client communicates with webservice. When you have a device with Webservices API (JSR172) support then it's easy. When the device is without the Webservices API then you have to solve it in different way. You can create a middle tear that you'll communicate with a binary protocol. The middle tear can then connect to the webservice.

There are wizard for both cases in NetBeans Mobility Pack. You can find then in New File dialog in MIDP category.
The J2ME Web Services Client wizard generates the client stubs from provided WSDL file. The Mobile client To Web Application wizard generates both parts necessary for communication - client and server part. You can generate client comunnicating either with a class/servlet or with webservice client on the server. Both wizards generate Sample midlet for you. So you can easily understand and check how to work with the technology. Sometimes it's enought to accomodate the Sample midlet for your purposes.

Tuesday Jun 06, 2006

LAB-6205 Mobile Applications: Visualize it, Build it, Deploy it to Many Devices

Did you miss the J2ME Hands-On-Lab at JavaOne 2006?

Don't worry, Sang Shin published all the HOLs on his site. Go to page JavaOneTM 2006 Hands-on Lab for People Who Want to Use Their Own Laptops and at the bottom is the Mobile Applications: Visualize it, Build it, Deploy it to Many Devices.

It is for real newbies in NetBeans Mobility Pack. It will show you how to create HelloWorld application, then you will create more complex application which is able to send SMS messages. And the last exercise is about device fragmentation solution in Mobility Pack. The hands-on-lab is pretty descriptive and explains the problem very well (IMO). Enjoy it. I'll welcome any comments...

Tuesday May 30, 2006

Developing for Jasper S20 with Mobility Pack for CDC

I played with the SavaJe Jasper S20 for a while. I wanted to know how it cooperates with NetBeans because the NetBeans Mobility Pack 5.5 Preview for CDC was really a secret project. You can develop and test on Sun Java Toolkit 1.0 for CDC with the build. I created an easy application. Then I borrowed one SavaJe phone and deployed the application to the phone directly from NetBeans IDE. That's cool. I wrote down a few steps to start with the development for CDC in NB. At the end of the article are some links to others tutorials and articles. Enjoy.

  1. install drivers for SavaJe (on SavaJe CD in directory E:\\GSPDA Mobile Drivers\\)
  2. download and install NetBeans 5.5 Beta + Mobility Pack 5.5 Preview Update 1 for CDC
  3. download and install Sun Java Toolkit 1.0 for CDC (early access available now). [the download button is at the bottom of the page]
Deploy to the Phone and Run
  1. Run NetBeans IDE
  2. Add CDC Platform to NetBeans' Java Platfrom Manager (flash demo)
  3. Create New Project (File | New Project) for CDC. The icon of the project looks like on the picture on right.
  4. You can try to run the application in the emulator first. (flash demo)
  5. Set directory to deploy in Properties
  6. Deploy the project to the SavaJe phone (flash demo)
  7. before running the application on the phone. (flash demo) The card can be used either by windows or by the phone.
  8. Run the application on the phone. It is located in Menu | My Applications
Debug on Device
  1. Set the Debug port in Properties of the project
  2. Check the Add debug information to jnlp file checkbox
  3. To set up the SavaJe phone correctly follow the steps on SavaJe twiki
  4. I'm able to ping the phone IP
    Pinging with 32 bytes of data:
    Reply from bytes=32 time=3ms TTL=255
    Reply from bytes=32 time=2ms TTL=255
    Reply from bytes=32 time=1ms TTL=255
    Reply from bytes=32 time=2ms TTL=255
    Ping statistics for
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 1ms, Maximum = 3ms, Average = 2ms    
  5. Deploy the application with updated informations in jnlp file. Unmount it.
  6. Start the application on the phone. It won't do anything it should wait for the connection from the debugger
  7. Run -> Attach Debugger. Set the properties
          Connector = SocketAttach
          Transport = dt_socket
          Host =
          Port = 9462
  8. You should be attached to the application and you can debug. It doesn't work for me. I still receive "Connection refused."

More Informations...
Flash Demos

Thursday Apr 13, 2006

[FLASH] Floating point - only in CLDC 1.1

You can specify the configuration and profile of your platform in project properties. This short simple demo will show you how to do it.

I recorded it because somebody was asking why he cannot use floating point in his Java ME development. You can. You have to set CLDC to 1.1 because you cannot use floating point in CLDC 1.0

CLDC 1.0 is subset of CLDC 1.1 The same about MIDP 1.0 and MIDP 2.0
You'll have to choose the right combination for your phone.

Don't be suprised that some emulator platforms from other vendors supports only CLDC 1.0 and MIDP 1.0
It can be either by bad configuration of the platform or it is the restriction of the platform. You can overwite the profile and configuration attributes (not enabled by the device platform) in the project properties. Look at end of this post where it's described

Thursday Apr 06, 2006

Using Motorola's SDKs in Mobility Pack

I already wrote a post about it. The Motorola's document is more descriptive and complex. Worth to read when you want to use their SDKs.

This is the main channel to share news, tips and other stuff related to my work. Sometimes you can find even personal stuff. Enjoy your reading...


« August 2016

No bookmarks in folder