New S60 Java VM

nokia.gifAs of S60 FP 2, Nokia will be changing their Java ME VM

"Prior to 3rd Ed fp 2, S60 Java had traditional CLDC VM architecture where all API code (class files) were compiled into the virtual machine executable. Now the Java API implementation code is no longer in the VM executable but will be dynamically loaded when needed."

For people not familiar with Java ME implementations, let’s dissect this a little. JAVA ME is actually implemented using (written in) JAVA ME itself (class files mentioned above) together with JNI style calls into Symbian c++/c to do stuff on the platform. Previously, all this was compiled up into one huge exe – in fact if you look in the SDK you can see it’s the largest exe on the S60. It takes a long time (and a lot of memory) to start this up – this is reflected in the very long startup time for a Java ME application on pre- S60 FP 2. Loading parts of the VM only as required will now save time and memory.

Additionally…

"The new architecture allows us to dynamically extend the virtual machine with new APIs."

Examples are the new eSWT implementation and access to Internet access points, device IMEI, network access type (gprs / csd etc.), network id, network signal level, battery level, country code, date and time formats via system properties.

I am in two minds whether these kind of extension are a good thing. On the one hand they provide valuable information to Java ME applications. However, they are non-standard and don’t comply to any JSR. This means code that uses them won’t work on non-S60 phones. Hence, extensions like this increase fragmentation for developers.

Perhaps adaptations like this aren’t so bad when the platform itself has a large installable market. For example, you can do much more under BlackBerry Java ME due to it’s proprietary extensions. Enterprise customers for a Java app are happy limiting device choice to just BlackBerry so it’s less of an issue. However, initially at least, the S60 3rd FP 2 market will be very small and there’s bound to be end user confusion as to what Java apps will work on what phones.