Sun is trying to further implement it as a developer's target platform with the latest Java technology, but the Java platform itself is divided into three platforms: STANDARD version, Enterprise version and Micro version. Micro version, that is, the so-called J2ME, which is designed to be designed for mobile devices for small and low processing capabilities for use as a Java development platform. From the surface, this is a good thing for developers who wish to improve the mobile computing power of the application. However, the term "mobile device" covers a relatively wide range of areas, including traditional personal digital assistants (PDAs), so-called smart phones, pagers and even GPS units, etc., each having different hardware configurations. Similarly, the market of such equipment is also broken, and there is still a compatibility issue between the two equipment of the same supplier, let alone equipment products of different suppliers, in many cases, simply provide mobile devices for these five flowers. A universally applicable development platform seems to be more impossible. So J2ME defines two types of specifications, and they work together to provide a mobile Java platform, both of which are Configurations and Profiles. The Configuration and Profile specification have put forward considerable technical terms, let's discuss some.
CONFIGURATION
J2ME handles a large number of different mobile device hardware features by abstracting the Configuration abstraction. J2ME Configuration defines virtual machines and low-level APIs available to specific devices while providing the corresponding development basis. There are two kinds of Configuration currently available, which are connected to the Connected Device Configuration and Connecting Finite Equipment Configuration CLDC (Connected Limited Device Configuration).
Connection device configuration
The CDC is applied to a relatively large amount of memory, a mobile device that has a stronger processor. The CDC specification uses memory-optimized virtual machines, which is the so-called CVM, which provides equivalents of the standard JVM. According to Sun's document description, CDC is for high-end devices such as new PDAs, smart communication devices, and set-top boxes. In order to be supported by CDC, mobile devices must have at least the following conditions:
2 MB of memory for CVM and Java API libraries. 32-bit microprocessor or controller. A network connection can be used, preferably a high bandwidth connection.
Connection limited device configuration
CDC requirements are conducive to expensive mobile phones, IR scanners or similar products. CLDC is primarily for those devices that are lighter, cheaper and cannot meet CDC requirements.
CLDC uses a more dimensional virtual machine designed to run in a lower memory environment. This kind of JVM reference is also the so-called KVM, why is it called KVM? This is because the size of this virtual machine is based on kilobytes. The equipment requirements of CLDC are as follows:
Minimum 160KB memory, 128KB is used for KVM and runtime library minimum 16-bit 25-MHz processor limited user interface function without (or intermittent) low bandwidth network connection
Due to strict memory capacity restrictions, KVM has lacks some of the features provided by the full JVM, which means that you may have to change your programming style. KVM has to compromise the performance of floating point mathematics, reactions, and support for Finalizers classes under such low memory requirements. Developers who use CLDCs must be pre-verified by using one check tool provided by J2ME Development Kit after the compiler.
Profile
If the configuration provides the application for the application, the profile provides the application's framework. Profile defines a set of API classes available to J2ME applications and is specifically created for a given configuration. Sun launches two available reference J2ME Profile: Foundation and Mobile Information Device ProfileMIDP (Mobile Information Device Profile). Basic Profile is mainly used for CDC configuration, so its virtual machine is almost equivalent to standard virtual machines. This means that developers who use the base Profile must access the full implementation of the J2SE feature set.
MIDP provides a Java platform that you can use for development today's mobile device applications with low-cost CLDC configuration. MIDP supports a limited subset of J2SE libraries and uses custom-made user interfaces and input / output classes for use on CLDC configurations.
Write once everywhere?
How is compatibility? Can the J2SE application run on the J2ME platform? The answers to these issues mainly depends on the specific application of the configuration and Profile. The J2SE code can use CDC and base profile run without or rarely modified. However, as we discussed here, because the host hardware is restricted, CLDC and MIDP Profile only provide a very limited functional collection. So it is not much to run on such platforms without modifying, unless it limits yourself within the API intersection of the two platforms (severely limiting its function). Because the requirements of CIDC correspond to the function of most of today's handheld devices, any J2SE application wants to run in a given device without modification. You have to modify the application that needs to be ported to J2ME. But don't be nervous. It is not a good thing from the perspective of keeping the rice bowl.