Monday Jan 25, 2010

It is nice and polite when application writes log. Especially when something went wrong it can help to track down the source of problem.  JMESDK has several components which produce their own log files. Here they are:

Device-manager

  • This is core component for the product. It starts automatically and registers all devices and emulators. Since all communication goes through device-manager this log contains always the most important information.
  • Log file is placed into /user's home/javame-sdk/3.0/log/device-manager.log (windows) or /Users/username/Library/Application Support/javame-sdk/3.0/log/device-manager.log (MacOSX)

Emulator

  • Emulator loads its skin and starts cldc or cdc virtual machine (VM). Emulator and VM write log under the emulator instance working directory /user's home/javame-sdk/3.0/work/(instance ID)/device.log. How to get the instance ID? When emulator starts, ID is displayed in window caption after the name of device.

mini IDE

  • JMESDK contains simple IDE which is built on top of Netbeans platform and thus uses platform logging mechanism. It writes log into /user's home/javame-sdk/toolbar/3.0/var/log/messages.log

Friday Jan 15, 2010

I've got a question how to create custom emulator skins several times. It can't be answered in a few words, a short tutorial with an example will be the best way of explanation. Skin800x480The zip bundle here contains an example of standard CLDC/MIDP device with a display of 800 x 480 pixels and a few buttons. Due to lack of creativity I call the device "Skin800x480" and I have to admit it looks quite ugly.  I will use it as a reference throughout this tutorial. You can use it as a base for your further customization. Before we get to a details I need to say a few words about the installation of the device.

Installation

It is fairly simple. You just need to unzip Skin800x480.zip bundle into JMESDK 3.0 installation directory. (C:\Program Files\Java ME SDK 3.0 on windows or /Applications/Java_ME_SDK_3.0.app/Contents/Resources on MacOS) Restart of the device-manager is required.

Device definition and device instances

Files which you've just unzipped into JMESDK is a definition of a device. JMESDK installation directory contains only device definitions. Device definitions are during launch of the device-manager used to create device instances. After you have restarted the device-manager you can check that an instance of "Skin800x480" device has been really initialized. Have a look into your user home Library/Application Support/javame-sdk/3.0/work (MacOS) or Application Data/javame-sdk/3.0/work (windows). Device instances are identified by numbers from 1 to 6 (MacOS) or 1 to 11 (Windows). One more instance No. 7 or No.12 has been initialized by the device-manager after the "Skin800x480" installation. It's more less obvious what all files inside instance directories mean. I will let it up to you inspecting them and finding it out.

Test it

 Let's check that the installation has been successful now. Open command line and and call emulator to list properties of the new device. Usually you don't have to use -Xdevice switch but because the default device is "DefaultCldcPhone1" and not our "Skin800x480" you will have to specify always device name for every emulator command. Write:

emulator -Xquery -Xdevice:Skin800x480

Command will list profile and configuration of the device along with other properties like bootclasspath, screen width and height etc. It's time to start the device now, this time star it without an application. Write:

emulator -Xjam -Xdevice:Skin800x480

or with an application

emulator -Xdescriptor:../apps/Demos/dist/Demos.jad -Xdevice:Skin800x480

Use the device and you will see how buttons behave when pressed or when mouse goes over the button.

The device

JMESDK is highly customizable and lets you define new devices without touching a code. Flexibility is necessary since there is a big number of handsets out on the marked and they differ in many aspects. A display size or a color depth, controls, number and type of keyboards (midp, qwerty, sliding keyboard), number of displays (2 displays in case of clamshell phones),  hardware modules (GPS, battery level sensor, motion sensor), external memory card just to name a few of them. JMESDK can literally assemble a device from particular components to match as close as possible desired handset. Here is what we can use as a building blocks of our device:

  1. skin (a picture of the handset)
  2. display (number of displays, size, color depth)
  3. device states (open, closed)
  4. keyboards (keyboard layout and key codes mapping)
  5. JVM (runtime associated with a device)
  6. device properties (fonts, default locale, BT address, phone number, heap size, security domain and many more)
  7. hardware modules (GPS, accelerometer, sensors, memory card etc.) 

Making a device

Look into a zip file into devices/Skin800x480/conf. You need 3 skins (png bitmaps) of the device. 1st one displays device in "normal" state, 2nd in "highlighted" (how the button should look like when mouse goes over it) and 3rd one in "pressed" state (how button should change when it is pressed). In our case we have 4 buttons A,B,C,D and "joystick" in the middle with buttons Left, Right, Up, Down and Select.  Important part is the display. You have to ensure that the size of display fits perfectly 800x480 pixels. You will need to write down boundaries of each button and of the display as well.  We will use them later on in mapping of buttons and in dislpay setup.

Besides of 3 skin bitmaps mentioned above the folder contains a few other files:

  1. index.html, bg.jpg, skin-test-small.png - these files compose a device information page which appear in our small IDE when you double click a device in device selector.
  2. networkIndicatorOn.png - you need this if the device has a small light (network indicator) which blinks when there is a network traffic.
  3. modules file - devices are sharing some functionality across them. This file describes what support should be loaded for this device. Each row is a path to particular module. For example modules/emulator-cldc is generic cldc-hi runtime, skin/single-state-shared is a module common to all devices which have only single state, emulator/generic/ui/touch-screen-support is a module which enables touch screen support etc.
Display setup

We have bitmaps with a space for display ready. What we have to do now is just to place a screen buffer properly on the bitmap and set screen buffer size. We will do this in .bean files. These files are being read when device and its runtime starts. Each .bean file represents an object with given setters.

  • ScreenGraphics.bean::dimension is a setter for a width and height of a screen buffer. Proper value for our device is 800, 480
  • Screen.bean::position sets x,y location of screen buffer on a skin bitmap. In our case 21,21
  • NetworkIndicator.bean::bounds location and width of network inicator
  • NetworkIndicator.bean::image a name of network indicator png bitmap
Button mapping

Our simplified device has four-way joystick, select button in the middle and four soft buttons A, B, C, D. ButtonsMapping file is called default-state.xml. It defines one single state of the device. For example Clamshell phone has 2 states opened and closed and need 2 mapping files.

Here are parts of the file:

<device-state name="Default" defaultSkin="skin-test-normal.png" 
pressedSkin="skin-test-pressed.png" 
highlightedSkin="skin-test-highlighted.png" 
networkIndicator="NetworkIndicator">

device-state references 3 skin bitmaps -- normal, highlighted, pressed and a network indicator object. You need to put correct bitmap names here.

<button activators="VK_F1" vmKeyCode="-6" 
x="259" y="509" width="88" height="22"/> 

Each button is defined by its bounds (x, y, width, height) a vmKeyCode (integer sent to the runtime when button was pressed) and activator (keyboard activator for this button are VK_* constants, as defined in java KeyEvent class)

vmKeyCodes are defined as follows:

    UP           = -1,
    DOWN         = -2,
    LEFT         = -3,
    RIGHT        = -4,
    SELECT       = -5,
    SOFT1        = -6,
    SOFT2        = -7,
    CLEAR        = -8,
    SEND         = -10
    END          = -11
    POWER        = -12
    KEY_0 .. KEY_9, #, *, etc = ASCII code of the character. 
                               (vmKeyCode for printable character
                                is its ASCII code)

We don't have a button with printable character on our device but here is an example for number '1'.

 <button activators="VK_1 VK_NUMPAD1" 
vmKeyCode="0x31" keyChar="1" 
x="36" y="493" width="76" height="31"/>

Device adapter

Here I will talk about files related to the device manager. Device manager recognizes any device when its corresponding device adapter is installed. For every device adapter, there is a corresponding .bean file in process/device-manager/device-adapter.  Among other things adapter references runtime which should be used with this device. In our case it is cldc-hi-fx runtime (cldc/midp runtime with built-in JavaFX extension).  Since there is no other option for a runtime, I won't go deeper into settings of runtime in the adapter. You will better leave adapter files untouched. Just copy all files to use them for your own device, do the search through all files and replace Skin800x480 with a name of your own device. Although one thing has left to be mentioned here. You can add as many device instances as you wish. We have 1instance for Skin800x480. Instance .bean file is in process/device-manager/device-adapter/Skin800x480/1.bean. But can be copied to 2.bean, just change the setter deviceName to for example Skin800x480_1.

The end

I think we are done with simple customization. Definitely there's much more options to setup like device states etc. I've mentioned them all above. We can get back to them later if somebody needs them. I hope this entry will help to everyone who wants to create his own skin. Don't forget to share with us any skin you would create ...

Sunday Dec 27, 2009

As you probably know we ship Java ME SDK with cldc java runtime for Windows Mobile. You can deploy MIDlets onto Windows Mobile handset as easy as it was an emulator. Connecting a WinMobile handset from Java ME SDK is very straightforward using activesync on windows. It's really just a matter of plugging device and runing jvm on it.

Situation is different on Mac since there's no free activesync support. Fortunately most of WinMobile handsets come equipped with Wi-Fi and we can take advantage of Mac's AirPort networking. What we need is to create computer-to-computer network and let WinMobile handsets connect to the network. Only trick is to find out IP address of the handset. When you have the IP and you have started jvm let Java ME SDK look up the handset. Since it's recognized you can deploy MIDlet on it an also debug your applications right on the handset using Netbeans Mobility Pack. 

Before you start with this tutorial copy .cab file from Java ME SDK installation folder named "on-device" to your WinMobile handset and install it.

Create computer-to-computer network and give a name to it (in our example "MyNetwork").

On handset look into Settings->Conections->Wi-Fi and search for computer-to-computer networks and connect to network. After your handset is successfully connected to "MyNetwork" look at details of Wi-Fi adapter where you find assigned IP address. Just to be sure open terminal and try to ping the handset

ping 169.254.205.222

if your handset is reachable you can continue in Java ME SDK. Launch JMESDK and look at Device Selector window where 2 new buttons have been added in version 3.0 for Mac. Look at the image below where the buttons are highlighted

The first one  opens a wizard which helps you to connect to handset. All you need is to specify IP address. When the jvm on handset responds to look up from JMESDK it is added under the device node "Other" as you can see on the image above. Second button  refreshes connection to handset. My htc diamond falls asleep after some time and when it is awake I need to refresh connection. Device registration can be made also from command line

device-address add ip 169.254.205.222

or on device-manager. Click on device manager icon  in status bar and choose manage device addresses.

Now with the handset connected you can deploy MIDlet on it. Just open one of the sample projects right click on CldcWinceEmu1 node and choose "Run Project".

Of course all of this you can do also without Mac AirPort simply over the Wi-Fi router if you have one available. About debugging on-device using Netbeans Mobility Pack I will write soon. I suppose after you're successfull with this setup you will figure out how to make it work for Netbeans MP as well.


Tuesday Dec 22, 2009

Merry Christmas to everyone and especially to all Mac users. There's still few days remaining to Christmas but we are giving presents already. Thanks to great effort of software and quality engineering during last weeks we have managed to wrap up our Mac release before end of this year and make it public today. You can download Java ME SDK 3.0 for Mac OS and try out Java ME cldc/midp mobile development on Mac OS for the first time.

Java ME SDK 3.0 for Mac OS contains these key features:

CLDC/MIDP emulator supporting multitasking built upon CLDC 1.1 and MIDP 2.1.
  • Contains complete Mobile Service Architecture (MSA 1.1) stack except JSR234 - Advanced Multimedia Supplements
  • Mobile Sensor API (JSR 256)
  • XML API for Java ME (JSR 280)
  • Payment API (JSR 229)

On device deployment and debugging support

  • SDK comes with one-click solution for easy testing your apps right on the device.
  • Windows Mobile JVM is included in SDK

Integrated Lightweight UI Toolkit

  • LWUIT version 1.2 library and resources manager integrated into SDK makes development of rich UI easy

CPU profiling support

  • A built-in profiler lets you easily profile CLDC/MIDP applications. The profiler is based on the successful Netbeans profiler used in VisualVM, which is bundled with Java SE 6

New development environment based on Netbeans 6.7 platform

  • SDK leverages the successful Netbeans platform. A shared project system allows easy transition of your project to the rich, full-featured CLDC/MIDP development tool Netbeans Mobility Pack

JDK 1.5 and JDK 1.6 support

  • Both JDK are now supported although upgrade to 1.6 is recommended

Device search database

  • Technical specifications of thousands of mobile devices are now available through the database search tool.

Java FX Mobile emulator

  • The SDK includes the JavaFX Runtime version 1.2.1 and two default phone skins for JavaFX Mobile.
An important note for users of Early Access how to uninstall:
  1. stop all emulators and Java ME SDK IDE
  2. stop device-manager. If running on jdk 1.6 click on the icon   in status bar and chose Exit. If running on jdk 1.5 use ps aux | grep device-manager.app and kill the process
  3. remove Early Access rm -rf /Applications/Java_ME_SDK_3.0.app
  4. remove working directory rm -rf /Users/<username>/Library/Application Support/javame-sdk

Merry Christmas and happy New Year

- Your Java ME SDK Team

Monday Dec 21, 2009

Some time ago I asked you how are you familiar with Device Selector. I'd like to thank everybody who answered the question. We have got lots of interesting information. More than half of participants answered "I don't know what Device Selector is." I didn't expect so high percentage of votes for this option so this is a good chance to say a few words about Device Selector functionality.

Device Selector is a small window in the bottom left corner of Java ME SDK development environment. In general you can use it to set emulator properties or simply run project on different emulators. This screencast shows you Device Selector in action.

Saturday Dec 12, 2009

We got some complains that early access version for MacOSX lacks 3D Graphics support. I know that 184 is very popular JSR and I'm really happy that the situation has changed for upcoming final release. Thanks to cooperation with HI CORP we were able to integrate their MascotCapsule V4 rendering engine into MacOSX emulator. Stay tuned final release is coming soon ...

Wednesday Oct 28, 2009

SiliconIndia, India’s professional networking portal, is organizing Mobile Application Conference India in Bangalore on this Saturday. Sun is a technology partner of the conference and it is an opportunity for you to see Sun's mobile technologies in action. I was told that there will be also a demonstration of Java ME SDK 3.0. Sun India team is looking forward to meeting you there if you have a chance to come.

Mobile Application Conference India

Monday Oct 26, 2009

If you are running Java ME SDK 3.0 Early Access for Mac OS X you might experience preverify problem and got VERIFIER ERROR message. To fix it run following command in /Applications/Java_ME_SDK_3.0.app/Contents/Resources/bin path:

lipo preverify -output preverify -extract i386

It leaves only 32-bit version in the preverify file and takes out the 64-bit version.

Thursday Oct 22, 2009

Mac developers have often asked when Java ME SDK 3.0 will be available for their operating system. We always answered that we were working on it. Today is the day when it happened, we have released Java ME SDK 3.0 Early Access for Mac OS X. You can download it from http://java.sun.com/javame/downloads/sdk30.jsp.

Highlights of  Java ME SDK 3.0 Early Access, Mac OS X:

  • Bringing functionality of the famous Wireless Toolkit to Mac developers
  • Unique architecture enabling work with the real device from ME SDK 3.0 now running on Mac OS. Communication with the devices, application deployment and even On-Device debugging over the Wi-Fi.
  • Support for the latest CLDC Hot Spot VM and Java Micro Edition APIs
  • High End Tools for optimizations: Profiler, Network Monitor, Support for Debugging, Wireless Messaging Console and many more
  • Introducing JavaFX 1.2.1 Mobile emulator running on Mac OS
  • Integrated Device Search Database for easy reference
  • Powerful Autoupdate for additional plug-ins and product updates
  • Development Environment based on NetBeans Platform 

Tuesday Oct 13, 2009

There is a new component device-manager in Java ME SDK 3.0 which is a cornerstone of the SDK. It runs in background and only a small icon in notification are on taskbar shows that it is up and running. It keeps running even if you're not working with Java ME SDK and it's launched along with start of the system. Not very nice ... You can easily get rid of autostart just open regedit and remove entry "Java(TM) ME Platform SDK 3.0" under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Monday Oct 12, 2009

Java ME SDK 3.0 was released half a year ago. During this time you have got a lot of experience with this product and we would be happy if you could share it with us. It helps us to improve the product to satisfy your needs. Today we would like to know your opinion about Device Selector.

Thank you for your vote. If you want to share more experience about Device Selector with us use Comments, please.

Friday Oct 09, 2009

Last week was very interesting for us. We spent two days in usability lab observing how people use Java ME SDK 3.0 and we collected a lot of useful information from this usability study.

We could see four usability study participants every day. Some of them were professional developers, some of them students with different level of Java ME knowledge. It was a really edifying experience to observe people with varied Java ME skills using a product which they haven't had seen before. Each participant got one and half hour to finish three tasks. The tasks were designed to cover general product functionality as well as specialized features, e.g. sensor emulation. Java ME SDK engineering team did a lot of notes and we are also looking forward to results from the user experience team who organized the study for us. We should get the results next week but we have already started to think how to improve the product usability.

Do you want to know how the usability lab looks like? It consists of two rooms, darkened and well-lid, separated by two-way mirror. It allows people in the darkened room to see into the lighted room but not vice versa. I'm sure you know this kind of room from criminal movies. In our case the rooms are equipped better than on police stations and usability study participants feel there more pleasantly than suspects in police interrogation room. We are also much more friendly than police officers :-)

The participant sits alone in the lighted room and working on usability study tasks. Participants are asked to think aloud to allow observers in the next room to follow their mind. User experience team is recording participant's voice, face and desktop to be able to analyze their work-flow later.

We'd like to thank to all participants for attending Java ME SDK usability study and to user experience team for organizing this study. It was very inspiring for us. Thank you!

Following pictures show participant and observers rooms.

This is what really didn't happen during the usability study ... at least not during our study :-))




Thursday Sep 03, 2009

Today I'm not going to write anything serious and even anything related to the mobile development. As every working day I came to the office, started to read emails and found one with a link to A Tribute to Sun Microsystems web page. It moved me back in time. Before I joined Java ME SDK team I was a member of NetBeans engineering team, working on different parts of NetBeans IDE. I spent eight years working on this great product and from this time are also pictures which want to show you. Trip to one cold February day eight years ago starts here :-)

Looking out from the window it seems that autumn weather came to Prague. Winter will be here in a few months and hopefully there will be good conditions for another snowball batlle, this time between Java ME SDK and JavaFX teams :-)

PS: I'm throwing the snowballs from the farther terrace.

NetBeans Snow Battle

Tuesday Aug 25, 2009

That's a question we have got a lot of times. It was answered here and in different forums, describing why it take some time to release Mac version so I'm not going to write the reasons again. Today I'm going to show you something behind the scene. We are running Scrum process while developing Java ME SDK. Next two pictures were taken at the end of our latest sprint.

The first pictures shows our office board with table of stories and their tasks. As you can see we finished all tasks.

Taskboard

The second picture is more interesting. It shows burndown chart, which is a is graphical representation of work left to do versus time. The green line represents the ideal burndown. You can see that our progress was under the ideal line. It means that we worked faster and finished our tasks sooner than we expected when planning the sprint. Especially in the beginning the progress was quite rapid so in the middle of the sprint we added a few extra stories and we achieved all of them.

Burn down chart

That's what is happening in our team and hopefully answers the title question. Java ME SDK for Mac is in progress and it goes well ... stay tuned – coming soon to a computer near you!

Wednesday Jul 22, 2009

Three weeks ago has been released NetBeans 6.7. This release integrates Java ME SDK 3.0 so mobile developers can now use all advantages of NetBeans Mobility and Java ME SDK 3.0 together for their development.

For more information visit NetBeans 6.7 release information page.

This blog copyright 2010 by Radko Najman