Advanced KVM Topics

To close this chapter, we look at a couple of advanced techniques you can use with the KVM. If your focus is on developing applications for mass market wireless devices, the techniques shown in this section will be of little relevance, because they require you to be able to build your own copy of the VM from its source code and ship it along with your application. This is an option that is likely to be open to you only if you are using the KVM in a specialist application of some kind or if you are working for a device vendor incorporating the KVM into a new product.

In order to build the KVM, you need to download a copy of the CLDC reference implementation and acquire a suitable compiler and build tools. The details of the build process and the development tools with which it has been tested can be found in the KVM Porting Guide, which is one of documents included with the reference implementation. Since describing how to compile the VM is beyond the scope of this book, the rest of this section assumes you have set up an environment within which you can compile and link the VM using the Makefiles supplied by Sun.

Preloading Java Classes

In a J2SE system, the core class libraries are stored in the file rt.jar and are dynamically loaded and linked on demand from the point at which the VM starts up. This has two consequences, both of which are not ideal in the kind of limited-resource environment toward which the KVM is targeted:

  • The process of loading a class ...

Get J2ME in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.