We all know that Java ME was previously called J2ME (Java Platform, Micro Edition), and is a Java language platform for embedded consumer electronic devices such as set-top boxes, mobile phones and PDAs, including virtual machines and a series of standardized Java APIs. Together with Java SE and Java EE, it constitutes three major versions of Java technology, and is also formulated through JCP (Java Community Process).
There are several important concepts in the J2ME platform, such as memory, CLDC, MIDP, etc. Beginners often don’t have a deep understanding of these concepts, and even have deviations. The purpose of this article is to explain the relevant important concepts in J2ME.
1. Memory
We have always emphasized that the memory of mobile information devices is very small and should be cherished twice as much as possible when using it, but we rarely know how these memory is classified. The following will introduce it in detail. In fact, there are three types of memory of MIDP devices: Programme Memory, Heap, and persistent Storage.
Programme Memory is the space allocated by mobile information devices to the MIDlet suite. Because the MIDlet suite is published as a jar file, the size of this file can be considered as the size of Programme Memory. Some manufacturers have restrictions on the maximum value of Programme Memory. For example, the maximum value of my Nokia 6108 is 64k. If it exceeds it, it will not be installed. It is very important to reduce the size of the MIDlet suite. A convenient way is to use an obfuscator to obfuscate the application, which can reduce the size of the jar file. In a future article I will talk about how to use Proguard.
Heap is the storage space for the application to store the created objects during its operation. Local variables and member variables are also placed on Heap. The Heap space provided in the MIDP device is about tens of k to hundreds of k.
The space of Persistent Storage is used to implement the persistent storage of local data in MIDP applications. I have introduced the Record Management System from the beginning to the mastery of this article. I won’t talk about it in detail here.
2. Connected Limited Device Configuration
CLDC includes a Java virtual machine and a series of basic classes. The J2ME expert group obtained their characteristics after hardware abstracting the mobile information device, and then designed and implemented a Java virtual machine running on the mobile information device. Usually we put it into It is called KVM. In CLDC1.0, it also provides basic classes composed of java.io, java.lang, javax.microediton.io, and java.util. java.lang.ref was added in CLDC1.1.
3. Mobile Information Device Profile
MIDP runs on the basis of CLDC. In MIDP, subsets of the application life cycle, user graphical interface, data management system, etc. are defined, thus building a J2ME platform. Generally, the J2ME platform consists of a CLDC and one or more Profiles.
I hope that through the introduction of the above content, you can better apply the J2ME platform.