J2ME (Java 2 Micro Edition)

zhaozj2021-02-08  325

■ Foreword If you have inquired on http://www.javasoft.com, query about Java 2 Micro Edition, ten shots will be made by a large pile of technical nouns. What KVM, what CLDC, CDC, MIDP, also appeared in Personal Java, Embedde D Java, and JES. Although the tiny version named Java, its world is really not small, let us full of stomach "see the mountain is not the mountain, see the water is not water". Indeed, when I just started to get in touch with Java 2 Micro Edition, I felt that this thing is, the more I can't touch the clue. So in this chapter, I abandoned the technical details, I would like to take everyone to see the world of Java 2 Micro Edition from the perspective of Giants. I hope that after reading this chapter, you can make everyone experience "see the mountain is the mountain, see the water is water", all suddenly feels cheerful. First, we must first understand the positioning of Java 2 Micro Edition in the entire Java technology. ■ Development of a variety of Java programs, as mentioned earlier, a variety of Java versions, the integrity of their support, and the two things supported by the Java basic types. Differences, that is, no matter what you develop is the Java program used by the enterprise, the Java program executed on the embedded device, the applet executed on the browser, or the application executed on the PC. You must install J2SE on your computer, then install a variety of versions of core category libraries and additional expansion category libraries, which can successfully develop a variety of different purposes Java programs. Java Compiler (JavaC.exe) provided by J2SE can help we compile the Java programs on various platforms, while Java virtual machines provided by J2SE can help us test these programs first on P C. The correct or not the result is correct. In addition, the Java compiler does not help you check if your program meets the core category library supported on a variety of platforms and Java basic models. For example, although we have said before, the Smart Card version does not support Boolean, the basic type of Java other than Byte, and the platform only supports java.lang. * Core category, but when we write a Smart Card platform When the program uses the Java basic type other than Boolean or Byte in the program code, or uses other core categories other than Java.lan G. *, The compiler can still compile you to the category file. At this time, everyone must start to produce doubts - if these programs are executed on the smart card, what should I do? Don't you cause an error when the virtual machine on the Smart Card is wrong? Total potential for this Problem, Sun Microsystems In various different versions of the development kit, some will have a checkor or preverier, these two tools can help you check the program before you go to the target platform. And pre-reviewed work. The inspector will help you find some parts of the target platform specification in the class file and remind you that these places may not be executed on the target platform. Therefore, as long as there is an inspector, you can basically determine that your program can meet the rules of the target platform and perform smoothly. An inspector is accompanied by the Java Card's development kit.

The development kit of some platforms is accompanied by a pre-audit. In addition to the work made by the inspector, there is an additional work, which is to reduce the burden on the virtual machine on the target platform. To explain the pre-audit. Additional work, in the traditional Java program, for a safe consideration, any category that enters the execution environment (regardless of the class gear is from this unit or remote machine), you must first pass through the BYTE CODE review ( The verification of Byte Code Verifier is to prevent the program from being malicious modifications on the transfer, but make the Java program have adverse effects on the system during execution. After review, this class can begin to be executed by the J virtual machine. If this audit is performed on a general PC, the speed is also acceptable, but once the CPU such as Palm or the mobile phone is slow, the memory is less likely to be very tight. In order to save valuable CPU calculation time (can save electricity can be executed), program designers must first review pre-auditors in PC before the programming designer produces a class file enabled by some specific platforms. Do some pre-review work, the pre-audit will add some special tags or symbols in the category file. As a result, when these programs are executed on the target platform, they can significantly reduce the time when they are reviewed on the target platform, and the startup and execution speed of the speed program will be accelerated. So the program under J2ME (Spotlet, MIDlet), its execution step becomes a pre-audited relationship, the work of the Byte Code auditor is less, and therefore the time from the program loaded between the start execution Thus shortening. CLDC standards and pre-audit are accompanied by the actual works of the MIDP reference. ■ Java version of the evolution believes that people who are familiar with Java evolution history have heard that Java technology is not just called Java, but is called Oak, and the first time is a product designed for embedded systems. . Later, because of the development of the Internet, the many features of Oak are just suitable for use on the Internet (such as portability, the program code is small), because the trademark has been registered, so Oak is renamed into Java, Since then, it will become a shining superstar on the Internet, and more non-originally related applications are slowly generated over time. Although Java has been used on many enterprise software, it is still very suitable for use in embedded systems. Although Java is widely used in the development of the table application and Applet from Java 1.0, Java starts from Java 1.1, Java returns to the old road at the beginning - that is, the embedded system Application, the Sun Microsystems published two specifications of Embedded Java and Personal Java (also known as PJAVA). The e Mbedded Java is designed for the resource is very limited, and there is no embedded device for displaying the device; Personal Java is to connect with the Internet connection, and have a consumer electronic device that displays a display system (such as color LCD). design. Then Java version evolves to Java 2, then the three versions of J2EE, J2SE, and J2ME are divided in order to distinguish between various Java applications. Various features of these three versions we have described in detail in the previous example, and will not be described here. However, please remember that since Java 2 divides the Java application area into three blocks, the development of the Java program language will not spread out like Java 1.1, so that everyone will help you all kinds of java The application is clear, but will not cause the chaotic situation that will not be packed in the future.

At extra, it is, and when Person Al Java has developed to version 1.2, it also uses some Java 2 platforms related to security. ■ Java 2 Micro Edition Overview J2ME follows the basic principles of "a single development system that makes a single development system for a variety of different devices". So J2ME first distinguish between all embedded devices into two: one is a limited function, and the power supply is also limited (in addition to PDA, mobile phone); the other is relatively better. And relatively sufficient embedded devices on power supply (computers, refrigerators, TV boxes (SET-TOP BOX). Because of these two types of embedded devices, Java introduced a concept called Configuration, and then defined the above operational function, limited electricity, limited to the CONNECTED LIMITED Device Configuration (CLDC) specification; The specification is specified as the Connected Device Configuration (CDC) specification. That is, J2ME first uses all of the embedded devices into two abstract types using the concept of Configuration. In fact, everyone can use Configuration as a specifications for the J2ME for two types of embedded devices, and these specifications define these devices at least in line with the computing capacity, power supply capacity, memory size, etc. A set of categories that can be used in the Java program executed on these devices. The category library defined in these specifications is the subset of Java standard core category libraries and the characteristics of this type. Expansion classifier library. For example, on the CLDC specification, the core category library that can be supported is java.lang. *, Java.io. *, Java.util. *, The expansion class library is Java.MicRoEdition.io. *. After two main Configuration, J2ME then defines the concept of Profile. Profile is the specification of the architecture in Configuration. The concept of Profile is to make it easier to learn how the Java program is developed on various embedded devices and what features they should have. Therefore, Profile defines the expansion class library that is very relevant to a particular embedded device, and how the user interface on various embedded devices is defined in the Profile. The expansion classifier library defined in Profile is established based on the core class fuse library defined in the underlying Configuration. ■ Java's application on embedded systems Because Java itself initial design concept is a directions for embedded systems, it is really like a fish in an embedded system. On this Time and Space Delibrium Point of LINUX, there is an article on the inter-embedded Linux and Java to create a double-win situation. This is a white paper published by the columnist Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy Randy. "Java and embedded Linux cooperation". In this article, the author put forward his views on the individual advantages of embedded Linux and Java, and also proposed the concept of Java-Lin UX platform. Interested readers can come to the following websites reference related news and materials.

1. Java and embedded Linux cooperation white paper http://www.ctech.com.tw/d-news/news/linux/89090208.asp 2. Java and embedded Linux cooperation http://www.linuxdevices.com/ News / ns5973673868.html 3. Coming Java-Linux combined with http://www.linuxdevices.com/articles/at7102892618.html ■ Why use Java to write applications on PDA? Since the coming of the present movement communication Therefore, the prospect of the communication related industry has changed, and in addition to reaching the main tools of the action communication - exquisite mobile phone months, there are more vendors to invest in the production and development of PDA. Originally PDA main platforms have Palmos, Windows CE, and EPOC, and I don't know how long it has been invested in Embedded Linux. It includes the @vis job system developed by the Domestic Security Association, and Mutual Technology also has their own embedded. Operating system, of course, no need to say that mainland manufacturers are in Korean manufacturers. Hey! The number of these operations platforms really don't know twice as much as the PC. For general users, there is of course small impact, but for program developers, see so many different procedures development platforms, it is really hopeful. If each platform has its own procedures and a library, then light is to look at the above platforms to learn more than five procedures. Of course, only a platform is of course a good thing. However, the programming man can't help but say: "If we write it, can be executed on these platforms without modifying the original code, isn't it more perfect?" For program developers, such investment The compensation rate is of course the biggest. To develop programs on that multi-platform, it is indeed a big challenge for program designers. If you want to put all the time and energy on the usability of the software, then there are many time we don't have so much time. Procedures for various platforms. To solve this problem, generally specifically, the programming will use a cross-platform cross-platform that can achieve at least Source Cod E Level across platform (Example QT). However, in this article, it is a more ultimate solution - Java, using Java's "Write Once, Run Anywh" feature, we can truly reach the program, just write it once, get any platform can be implemented (Of course, the premise is that the manufacturer of PDA must also make the Java Virtual Machine of the platform). The procedure with Java to do PDA has its own shortcomings. The most widely known may be the problem of performing efficiency, and Java has always made people in the issue of execution. However, the author believes that as the technology is developed, there will be faster and more power-saving PDA-specific CPUs, so the problem of efficiency can be ignored. What's more, when Sun is designed J2ME, many ways to try to speed up the execution speed of Java on the PDA (for example, pre-review). ■ Summary After reading this chapter, do you have a roughly understanding of the entire Java 2 Micro Edition? Before entering the next chapter, please be sure to understand the proprietary noun mentioned in this chapter. If you want to do more detailed understanding of various technical specifications, please refer to the page listed in the table below.

转载请注明原文地址:https://www.9cbs.com/read-226.html

New Post(0)