Sun Microsystems offers the J2ME Wireless Toolkit free of charge for developing game MIDlets (a Java program for embedded devices) withJ2ME. This section will briefly describe the following:
How mobile games can be developed using J2ME
How to use J2ME emulator for testing
Using J2ME
Mobile games developed with J2ME require various development tools for compilation and testing. Any games created using J2ME are through MIDlets classes, which is a Java program for embedded devices. MIDlets classes are stored in Java byte code files with a .class file extension. To prevent any illegal operations due to the limitations of virtual machine (known as K Virtual Machine - KVM) used in mobile devices, MIDlets classes need to undergo preverification. Preverification takes place after compilation, and results in a new class file being generated that is verified and ready for testing or distribution. MIDlet must be specially packaged in JAR (Java Archive) files for distribution. Following are the pieces of information typically included in a MIDlet JAR file:
MIDlet classes
Support classes
Resources (images, sounds, and other media content)
Manifest file (.mf file)
a special text file included to describe the classes contained within the archive.
Application descriptor (.jad file)
a file that provides descriptive information about MIDlets contained within a JAR file.
Using Emulator
Emulator emulates a physical mobile device on your desktop computer. This allows you to test MIDlets within the comforts of your desktop computer without having to download the code onto a device. The reason for using emulator is to overcome the practical difficulties of downloading code onto a physical device over and over as you diagnose bugs and make changes.