Write mobile app with Java Motorola Ideen

xiaoxiao2021-03-06  44

Title Use Java to write mobile app Motorola IDEN selection from a BLOG keyword J2ME home http://www.chinabyte.com/20020725/1622124.SHTML preface All operations of this article are tested on Windows 200 operating systems. If you verify this text on a different platform, such as Windows 98 or Windows Me, we cannot guarantee that there will be the same results. Introduction I don't know when I start, we suddenly feel that people around them have a mobile phone. Using mobile phones to communicate with others into part of our lives. The people of certain advanced countries in Nordic can use mobile phone to purchase the goods sold by vending machines; they can also use mobile phones as a certification tool when they are engaged in Action Business (M-Commen). Many additional features of the mobile phone in Japan are part of young people culture. The upcoming 3G, wireless broadband, a beautiful dream, brought people to the future of wireless communication. Then, some vendors start selling their own PDA, as if there is no PDA in hand, it is not like modern people. A wide variety of PDA floods the market, sell well and not sell well, makes people look. At this time, a big problem is generated - we have a very troublesome thing to carry your mobile phone and PDA - even if they are still light and short. If you can combine your mobile phone and PDA, isn't it more convenient? So I heard the manufacturer of consumer's voice, starting with products that launch mobile phones and PDAs, from NOKIA 9000, Motorola A6188 (Tai Chi), to recent The Ericsson R380, Nokia 9210, is an example of a combination of mobile phones and PDAs, although because of the price of the price, these products are still high-order products that many people dream of. Despite the emergence of PDA combined with mobile phones, we still feel that everyone must find that the application is insufficient, although mobile phones and PDA combine, but the PDA function on these products seems to die. of. We can use C / C on PLMOS, Windows CE, EPOC, etc. to write applications on these platforms on PDA, but have never had a chance to download us on these mobile phones (even The PDA of the phone is also using EPOC, such as Ericsson R380). I believe that the manufacturer also heard the voice of the engineer who likes to write the program everywhere, so since the end of 2000, there will be many mobile phones that support Java's mobile phones will be launched. Of course, these manufacturers also offer the development procedures on the mobile phone. SDK, we can finally write some small programs to your mobile phone! This is the dream for a long time. The diversity and complexity of the mobile phone platform can be said to be more than the PDA, so everyone can know - Ha! It's a Java sent a time. We all know that the Java program executed on the browser is called Applet, the Java program executed on Palmos is called Spotlet, but the application executed on the phone we call MIDlet, I believe that everyone is a strange noun, this It is also the protagonist to introduce this article. Support Java's mobile phone model is known to have Nokia (expected to launch a mobile phone NOKIA 9210 that supports Java in early 2001), Motorola (will first support Java on mobile phones that support Integrated Digital Enhanced Network (IDEN) network, then then A GSM mobile phone that supported Java has been launched. The company's mobile phone will receive Java in 2002 and NTT DoCoMo (will launch mobile phones that support Java in the second quarter of next year).

Although these big companies are ready to support Java, only when deciding this article, only Motorola is open to the website on the website for the program developer download test, so this article is based on Motorola J2ME SDK. Due to the unable to achieve these mobile phone markets, our procedures are implemented in the simulator attached to the SDK. I believe that when these mobile phones are listed, the MIDlet we have written should be easily and successfully executed on Motorola's mobile phone. Talented. How to get Motorola J2ME SDK, the first thing we have to do is Of course, I will still get SDK Luo! Please go directly to https://commerce.motorola.com/idenonline/ideveloper/ download Motorola J2ME SDK Drop 7. If you are not a member of Iden® Developer, please register (free) on the network. After the registration is successful, Motorola will send the password into your Email mailbox and then use the password to log in to my development center on the web page. After entering, you will choose the web page to enter the web page of the downloadable development tool. Please select Motorola J2ME SDK Components Developer Edition. Downloads below DROP 7.0, the download super-connected SDK, the size of the entire SDK is about 3 MB. Please note the Download Page for Motorola J2METM SDK installation before downloading, you will tell you the installation password, please refer. Time to install Motorola J2ME SDK on your computer, you will ask you to install your password, so be sure to write down this password. MOTOROLA J2ME SDK installation installation requirements According to official needs, the basic equipments of Motorola J2ME SDK are: Pentium 100 MHz Microprocessor 64 MB RAM Windows NT Workstation 4.0 Metallback Service Pack 3 / Win98 (this article is tested on Windows 2000 Professional Chinese version About 6 MB of hard disk space Java 2 SDK 1.2.2 (this article uses Java 2 SDK 1.3.0_01 Test) Install Motorola J2ME SDK Before you install the new Motorola J2ME SDK, please confirm that you have completely deleted the old Motorola J2ME SDK. . You can delete the old Motorola J2ME SDK by the "New / Remove Programs" in the console. Then you can clean the old Motorola J2ME SDK installed. Unlock the zip file you downloaded from the Motorola website, you will see a file called Motorola_SDK.exe, you can start the installation action on this file. Note that the system will be required to enter a password when installing, please enter the previously recorded installation password. Motorola J2ME SDK Directory Structure When you successfully install Motorola J2ME SDK, its directory structure is as follows MIDLET program structure. The program executed on your phone We collect MIDLET, and its program structure is simple, and the familiar Applet structure has a lot of work. Each MIDlet program must inherit since Javax.microedition.midlet.mIdlet category, and do three functions, they are:

Protected Void Startapp () protected void pauseapp () Protected Void DestroyApp (Boolean Unconditional) and a MIDLET program started with the end of our maps: writing and compiling MIDlet, please go to your Motorola J2ME SDK installation directory Under the Demo / MIDlets directory, a file named hellomidlet.java is new, and its content is:

HelloMIDlet.javaimport javax.microedition.lcdui *;. Import javax.microedition.midlet *;. Public class HelloMIDlet extends MIDlet {HelloMIDlet () {} protected void startApp () throws MIDletStateChangeException {} protected void pauseApp () {} protected void destroyApp (Boolean Unconditional) THROWS MIDLETSTATECHANGEXCEPTION {}} You will see a batch file named CompileAll.bat in the DEMO / MIDLETS directory, which is mentioned earlier, in addition to helping you compile all within ordered programs In addition, you can simplify the compiler of the MIDlet written by yourself. Enter: CompileAll Hellomidlet.java If you successfully compile, the result of the output on the screen is shown below: From the output on the screen, you can find it, let MIDlet can be executed on your phone, generally still have two Action (Similar to Spotlet), compiled and preverqing. For pre-review this action, the author has already mentioned the readers in the Run! PC November, "using the Java Writing Palmos Application Basic Articles", if you have questions about this, please Run! PC November number turned out! From this short MIDlet production process, I believe that everyone can find that the spotlet that can be performed on KVM compared to pure SUN's CLDC can be simply simple. The reason is that compileAll.bat This batch file helps us do most of Dirty Work. That, if you write a good program is not placed in the Demo / MIDlets directory, is it unable to compile? From CompileAll.bat, we can find it to help us complete the above two jobs. If we write a good program to the Demo / MIDlets directory, you can perform the following instructions, you can still make MIDlet: (We assume your Motorola J2ME SDK installed in the D: / MOSDK directory, and Place your own Hellomidlet.java in the D: /JDK1.3.0_01/MY directory. At the same time, we assume that you perform the following instructions at the D: /JDK1.3.0_01/MY directory.) Compile: javac -o - BootClassPath D: / MOTOSDK / LIB Hellomidlet.java Note: -BootClassPath points to the location of the class function library. Pre-audit: D: / Motosdk / Bin / preverifier -classpath d: / motosdk / lib ;. -d. Hellomidlet Note: 1. -classpath points to the location of the class function library, but also points to the location of the MIDlet we wrote . 2.-D Point to the path you want to be placed after the pre-compiling class file is generated, if you write "." Indicates this directory, override the originally compiled class file originally compiled. If you are not specified, the preset value is "./output" directory. Of course, if you are troublesome to manually, you can copy CompileAll.bat to other directories, and change its compile instructions to be related to the relevant settings related to the pre-audit instructions and class function libraries.

When it comes to CompileAll.bat, the reader will explain to the readers. In the previous mention, CompileAll.bat can help you compile all the sample programs located in the Demo / MIDlets directory, you only need to enter directly under the list: CompileAll . CompileAll.bat will automatically have the following items: com.mot.j2me.midlets.bouncecom.mot.j2me.midlets.imagetests.com.Mot.j2me.midlets.paddleballcom.mot.j2me.midlets.Scribblecom.mot .j2me.midlets.testscom.mot.j2me.midlets.tutorials If you want CompileAll.bat to automatically compile the program under other packages, please turn on CompileAll.bat to modify its CompileClass environment variable setting. After modifying and executing the Midlet write program, everyone's most hoped thing is of course letting it execute on the phone, but because you can't get Motorola's mobile phone, we can only attach to the simulator included in the Motorola J2ME SDK. Execute our written MIDlet. When I believe that the phone is officially launched, it should be able to perform on the phone smoothly. At the bottom of the author, tell you how to use the simulator included in Motorola J2ME SDK to test the MIDlet you wrote. Before this, because the sample program we have written is just a simple MIDlet empty case, we must make it possible to display some information on the simulator, so modify the previous program example, so that it is as follows:

HelloMIDlet.javaimport javax.microedition.lcdui *;. Import javax.microedition.midlet *;. Public class HelloMIDlet extends MIDlet {private Display firstDisplay; private Form firstForm; HelloMIDlet () {firstDisplay = Display.getDisplay (this); firstForm = new Form ( "Hello MIDlet"); StringItem firstStrItem = new StringItem ( "Hello", "MIDlet"); firstForm.append (firstStrItem);} protected void startApp () throws MIDletStateChangeException {firstDisplay.setCurrent (firstForm);} protected void pauseApp () {} Protected Void DestroyApp (Boolean Unconditional) THROWS MIDLETSTATECHANGEXCEPTION {}} Place this file in the / demo / midlets directory. After the compilation is completed, switch the directory to the Scripts subdirectory, and you will find some write batch files in this directory. These batch file instructions are executed in this directory to start the simulator. Instruction execution result executed as follows: Instruction: runEmul HelloMIDlet output: Instruction: runMotoi1000 HelloMIDlet output: Instruction: runMotoiDEN HelloMIDlet output: Instruction: runStarTac HelloMIDlet output: Instruction: runMyDevice HelloMIDlet output Error loading property file: C : /properties/myDevice.props (the system cannot find the specified path.) The error message will appear because you don't specify a mobile phone appearance that belongs to the user's self-reserve, you will teach you how to set your own custom Mobile phone appearance. If we will write a good program to the Demo / MIDlets directory, you can perform the following instructions, can still start the simulator and perform MIDlet: (We assume your Motorola J2ME SDK installation in d: / motosdk directory Among them, the Hellomidlet.java written in your own is placed in the D: /JDK1.3.0_01/MY directory. At the same time, we assume that you perform the following instructions at the D: /JDK1.3.0_01/MY directory.) Execute Simulator java -djava.library.path = d: / motosdk / lib -classpath d: /motosdk/bin/emulator.jar; d: /motosdk/bin/configtool.jar com.mot.tools.j2me.emulator.emulator -CLASSPATH.; D: / MOSDK / LIB JAVAX.MICROEDITION.MIDLET.AppManager Hellomidlet -JSA 1 1 Note: The first -classpath setting, between -classpath and path names have spaces. The second -classpath setting, there is no space between -classpath and path name. Execute the simulator and set the i1000 mobile phone appearance

Java -djava.library.path = d: / motosdk / lib -classpath d: /motosdk/bin/emulator.jar; d: /motosdk/bin/configtool.jar com.mot.tools.j2me.emulator.emulator -classpath .; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, The second -classpath setting, there is no space between -classpath and path name. Execute the simulator and set the appearance of IDEN mobile phone java -djava.library.path = d: / motosdk / lib-classpath d: /motosdk/bin/emulator.jar; d: /motosdk/bin/configtool.jar com.mot.tools .j2me.emulator.Emulator -classpath; d:. / MotoSDK / lib -deviceFile resources / MotorolaiDENPlatform.propsjavax.microedition.midlet.AppManager HelloMIDlet-JSA 1 1 Note: -classpath first set, and the path name -classpath There is a space between space. The second -classpath setting, there is no space between -classpath and path name. Execute the simulator and set the appearance of the Startac phone

Java -djava.library.path = d: / motosdk / lib -classpath d: /motosdk/bin/emulator.jar; d: /motosdk/bin/configtool.jar com.mot.tools.j2me.emulator.emulator -classpath D: / MOSDK / LIB -DEVICEFILE RESOURES / STARTAC.PROPS JAVAX.MICROEDIDLET.APPManager Hellomidlet -JSA 1 1 Please note: The first -classpath setting, the -classpath and the path name have spaces. The second -classpath setting, there is no space between -classpath and path name. Execute the simulator and set up the user's customs

Java -djava.library.path = d: / motosdk / lib -classpath d: /motosdk/bin/emulator.jar; d: /motosdk/bin/configtool.jar com.mot.tools.j2me.emulator.emulator -classpath D: / motosdk / lib -devicefile The absolute path is located> javax.microedition.midlet.AppManager Hellomidlet-jsa 1 1 Please note: The first -classpath setting, -classpath and path name There is a space. The second -classpath setting, there is no space between -classpath and path name. If you put your Props file under the resources directory of D: / MOSDK / BIN, the above instructions are changed as long as: -Devicefile resources / Note that when you use the above instruction to start analog If there is an error message: Error Loading property file: resources / defaultDevice.props (the system can not find the specified path.) This is because you did not copy the resources subdirectory under the D: / MotosDK / BIN directory to D: /JDK1.3.0_01/MY directory. When you debug the spotlet on the Palmos, we can use the System.out.Println () to help we print some messages to help debug, the midlet on your phone? In principle, we can still use System. .out.println () Voices do some output. When the simulator is executed, some messages are output on the command column. Also, on Palmos, Kvmutil.PRC can help our records output from the record. On the phone? Because there is no practical machine to test, this problem is still unknown now, I believe that Motorola will have a complete solution! In the instruction file attached to Motorola J2ME SDK, it is roughly When I arrived, I mentioned that if we want to debug on-device debugging, you must meet several conditions: the machine itself must have debug-related features and compatible with KDWP (KVM Debug Wire Protocol) . Because of debugging, debugging tools need to use KDWP and machines to obtain debug information. Manufacturing vendors themselves provide a way to download MIDlet to mobile phone for debugging. Provides a tool for MIDlet debugging, which must support the mobile phone that is used when using KDWP debugging (eg serial port or UDP). Well, it seems that it is very convenient to write, and the MIDLET program should be very convenient. Motorola J2ME SDK believes in Chinese support believes that the readers of the Run! PC November Number "Readers who use the Java Write Palmos Application Basics", you will have a problem that Chinese cannot display normally when writing the Spotlet on Palmos. Chinese issues are divided into two parts, one is a Chinese problem on the user interface, one is the Chinese problem on the output of the command (using the output of the system.out.println (), please do a small Experiment, change the program we have written in front as follows:

HelloMIDlet.javaimport javax.microedition.lcdui *;. Import javax.microedition.midlet *;. Public class HelloMIDlet extends MIDlet {private Display firstDisplay; private Form firstForm; HelloMIDlet () {firstDisplay = Display.getDisplay (this); firstForm = new Form ("Haro! MIDlet"); StringItem firstStritem = New StringItem ("Haro", "Midley"); firstform.append (firststritem); System.out.Println ("MIDlet);} protected void startApp () throws MIDletStateChangeException {firstDisplay.setCurrent (firstForm);} protected void pauseApp () {} protected void destroyApp (boolean unconditional) throws MIDletStateChangeException {}} MIDlet compile and present body after pre-audit, we open the simulator Perform this MIDlet, under the execution result: User Interface Output: Command Column Out: We have found that the preset compilation instruction will allow the user interface to output in Chinese, and the command column cannot output the correct Chinese. Then please change the original instruction javac -bootclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileClassPath. This MIDLET executes: user interface output: command column output: This result is different from the Chinese test results made on PALMOS. If you write a Spotlet if you use Javac. . . When the command, you will find that the user interface output on the simulator is garbled, but the output on the command column can output Chinese normally. But if you are using Javac -Encoding ISO8859_1. . . Instructions, then the user interface output on the CLDC in the simulator is output or the output on the command column turns garbled. It is not possible to output Chinese (this part is because the CLDC is fully attached to the simulator, resulting in actual machinery The result is different). In short, if the spotlet you have written cannot be output in the actual machine or POSE installed on the Chinese system, you can also add -Encoding ISO8859_1 in the compile instruction, you can see normal machine or pose. Chinese word. This problem will be generated, mainly because of the compiled Java class file (Byte code), all text codes use UTF8. For example, when you use the "Start" in the program code, the BIG5 encoding of the word "start" is B1D2. The BIG5 encoded of "moving" this is B0CA. We will use Javac XXXX.java to compile the original code to generate class files. In fact, this line of instructions is equivalent to Javac -Encoding "Big5" xxxx.java under the Windows environment of traditional Chinese.

That is, when the compiler reads the Chinese characters of the BIG5 encoding range, the BIG5 code will be automatically converted to Unicode, which means that after the table, "start" this The word Unicode encoded is 555F. The Unicode encoded of the word "moving" is 5272. Then use the UTF8 encoding to turn this Unicode to UTF8, stored in class files, so if you view class files with a text editor such as UltraEdit, you will see, "from" UTF8 encoding is E5959F. The UTF8 encoding of the word "moving" is E58B95. Next, when we want to output Chinese when execution, the JVM will be responsible for reading the UTF8 code, then transfer it to Unicode, and finally convert BIG5 based on the encoded encoded according to the system environment you are using, and then output to the screen on. However, after the test results, KVM seems to only read UTF8, and output it directly after converting back to Unicode. Less turn back to BIG5 steps, so the operating system is handled by Unicode as a BIG5, which naturally does not find the Chinese words corresponding to the code, and therefore outputs a bunch of symbols of a bunch of ?????. This is also what we have made in Palmos, even if we installed Chinese systems. OK, since KVM only helps us do half of the work, then, then we will do it, we will still keep the BIG5 encoding method, so we use the instruction javac -Encoding ISO8859_1 XXXX.java, Please do not deepen the two BYTEs encoded in the program code as one (because it is considered to be integrated) work), as long as Chinese is as a normal Western European alphabet set Therefore, when we use the above instructions, you will find Chinese turned into the class file, "start" UTF8 encoded as C2B1 C392. The UTF8 of the word "moving" is encoded as C2B0 C38A. You can find that the compiler uses the B1, D2, B0, CA as a code as a code. Thus, when KVM reads this encoding, they will turn them back to B1D2 and B0CA, and then the KVM is directly output, it can be used normally. Finally, the entire problem will be summarized, and the author's inferior, the simulator included in the CLDC does not use Javac -Encoding ISO8859_1 XXXX.JAVA instructions, which will make the command column to garbled, which is the normal result, and Motorola J2ME SDK The reason why the user interface in the internal attachment simulator is no problem, it is likely to be just because the simulator operation is different. Therefore, according to the output of KVM, it is likely that we must add the "" I must export Chinese in the actual mobile phone! Special thanks to the Tang Yulong, which is the Department of Seiiti University, ISO, Kailung.tang@msa .hinet.net) classmates. Because the author after he has been discussing, we can have a more in-depth understanding of J2ME's Chinese issues. Support Motorola J2ME SDK development tools to support the MIDLET development, the integrated development environment (IDE) that supports MIDLA J2ME SDK The CodeWarrior mentioned in the file. Believe other vendors, such as Borland, should also quickly use its product JBuilder's OpenTools API to support MIDlet development, not to mention Borland JBuilder currently has spotlet solutions.

Because the author can't get the CodeWarrior test, you can't provide you with yourself. I believe that if there is a chance, you will have a special manner to introduce you how to use CodeWarrior to write MIDlet. Motorola J2ME SDK comes with the part of the appendix to make a simple introduction to the use of CodeWarrior developed MIDlet, I believe it is quite enough for beginners. The Motorola J2ME SDK contains three auxiliary development tools in Motorola J2ME SDK, which can facilitate our program development, which are: J2ME Simulator (J2ME Emulator) allows you to be on your PC The simulation of Motorola will support J2ME mobile phone devices. This can be directly tested on the PC directly on the PC. Bytecode Verifier This validator is used to verify Bytecode in the classfile, which is not illegal to the memory. And confirm that all thections made by the type file loaded into the virtual machine are in line with the Java Virtual Machine Specification. Configuration Editor allows you to create or modify Device Profile. In the documentation included in Motorola J2ME SDK, the three tools have been described in detail, and the author will not go to it later. Summarize the call! Good tired, finally arrived at this summary! Do you think that MIDLET is ended like this? No! MIDET also has a lot of fun! We will be more deep in this series. Discuss the MIDlet. Let's see it next time. Appendix: Example Program Motorola J2ME SDK attached to many interesting examples, where they are located under the Demo / MIDlets / directory. Readers who are interested in continuingly can learn more about MIDLET, because of these examples of execution pictures, they will omit them, please readers to refer to the documentation. Examples of these procedures: Bouncecom.mot.j2me.midlets.bounce.BouncePaddleBallcom.mot.j2me.midlets.paddleball.PaddleBallScribblecom.mot.j2me.midlets.scribble.ScribbleFontDemocom.mot.j2me.midlets.tutorials.FontDemoGraphicsDemocom.mot.j2me .midlets.tutorials.GraphicsDemoRecordStoreDemocom.mot.j2me.midlets.tutorials.RecordStoreDemoUDP Tutorial Applicationcom.mot.j2me.midlets.tutorials.UDPReceiveAlertTestcom.mot.j2me.midlets.tests.AlertTestChoiceGroupTestcom.mot.j2me.midlets.tests.ChoiceGroupTestDateFieldTestcom.mot .j2me.midlets.tests.DateFieldTestFormTestcom.mot.j2me.midlets.tests.FormTestGaugeTestcom.mot.j2me.midlets.tests.GaugeTestKeyEventsTestcom.mot.j2me.midlets.tests.KeyEventsTestTextBoxTestcom.mot.j2me.midlets.tests.TextBoxTestTextFieldTestcom.mot .j2me.midlets.tests.textfieldtesttickertestcom.mot.j2me.midlets.tests.tickertest

HelloMIDlet.javaimport javax.microedition.lcdui *;. Import javax.microedition.midlet *;. Public class HelloMIDlet extends MIDlet {private Display firstDisplay; private Form firstForm; HelloMIDlet () {firstDisplay = Display.getDisplay (this); firstForm = new Form ("Haro! MIDlet"); StringItem firstStritem = New StringItem ("Haro", "Midley"); firstform.append (firststritem); System.out.Println ("MIDlet);} protected void startApp () throws MIDletStateChangeException {firstDisplay.setCurrent (firstForm);} protected void pauseApp () {} protected void destroyApp (boolean unconditional) throws MIDletStateChangeException {}} MIDlet compile and present body after pre-audit, we open the simulator Perform this MIDlet, under the execution result: User Interface Output: Command Column Out: We have found that the preset compilation instruction will allow the user interface to output in Chinese, and the command column cannot output the correct Chinese. Then please change the original instruction javac -bootclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileclasspath ../../lib% compileClassPath. This MIDLET executes: user interface output: command column output: This result is different from the Chinese test results made on PALMOS. If you write a Spotlet if you use Javac. . . When the command, you will find that the user interface output on the simulator is garbled, but the output on the command column can output Chinese normally. But if you are using Javac -Encoding ISO8859_1. . . Instructions, then the user interface output on the CLDC in the simulator is output or the output on the command column turns garbled. It is not possible to output Chinese (this part is because the CLDC is fully attached to the simulator, resulting in actual machinery The result is different). In short, if the spotlet you have written cannot be output in the actual machine or POSE installed on the Chinese system, you can also add -Encoding ISO8859_1 in the compile instruction, you can see normal machine or pose. Chinese word. This problem will be generated, mainly because of the compiled Java class file (Byte code), all text codes use UTF8. For example, when you use the "Start" in the program code, the BIG5 encoding of the word "start" is B1D2. The BIG5 encoded of "moving" this is B0CA. We will use Javac XXXX.java to compile the original code to generate class files. In fact, this line of instructions is equivalent to Javac -Encoding "Big5" xxxx.java under the Windows environment of traditional Chinese.

That is, when the compiler reads the Chinese characters of the BIG5 encoding range, the BIG5 code will be automatically converted to Unicode, which means that after the table, "start" this The word Unicode encoded is 555F. The Unicode encoded of the word "moving" is 5272. Then use the UTF8 encoding to turn this Unicode to UTF8, stored in class files, so if you view class files with a text editor such as UltraEdit, you will see, "from" UTF8 encoding is E5959F. The UTF8 encoding of the word "moving" is E58B95. Next, when we want to output Chinese when execution, the JVM will be responsible for reading the UTF8 code, then transfer it to Unicode, and finally convert BIG5 based on the encoded encoded according to the system environment you are using, and then output to the screen on. However, after the test results, KVM seems to only read UTF8, and output it directly after converting back to Unicode. Less turn back to BIG5 steps, so the operating system is handled by Unicode as a BIG5, which naturally does not find the Chinese words corresponding to the code, and therefore outputs a bunch of symbols of a bunch of ?????. This is also what we have made in Palmos, even if we installed Chinese systems. OK, since KVM only helps us do half of the work, then, then we will do it, we will still keep the BIG5 encoding method, so we use the instruction javac -Encoding ISO8859_1 XXXX.java, Please do not deepen the two BYTEs encoded in the program code as one (because it is considered to be integrated) work), as long as Chinese is as a normal Western European alphabet set Therefore, when we use the above instructions, you will find Chinese turned into the class file, "start" UTF8 encoded as C2B1 C392. The UTF8 of the word "moving" is encoded as C2B0 C38A. You can find that the compiler uses the B1, D2, B0, CA as a code as a code. Thus, when KVM reads this encoding, they will turn them back to B1D2 and B0CA, and then the KVM is directly output, it can be used normally. Finally, the entire problem will be summarized, and the author's inferior, the simulator included in the CLDC does not use Javac -Encoding ISO8859_1 XXXX.JAVA instructions, which will make the command column to garbled, which is the normal result, and Motorola J2ME SDK The reason why the user interface in the internal attachment simulator is no problem, it is likely to be just because the simulator operation is different. Therefore, according to the output of KVM, it is likely that we must add the "" I must export Chinese in the actual mobile phone! Special thanks to the Tang Yulong, which is the Department of Seiiti University, ISO, Kailung.tang@msa .hinet.net) classmates. Because the author after he has been discussing, we can have a more in-depth understanding of J2ME's Chinese issues. Support Motorola J2ME SDK development tools to support the MIDLET development, the integrated development environment (IDE) that supports MIDLA J2ME SDK The CodeWarrior mentioned in the file. Believe other vendors, such as Borland, should also quickly use its product JBuilder's OpenTools API to support MIDlet development, not to mention Borland JBuilder currently has spotlet solutions.

Because the author can't get the CodeWarrior test, you can't provide you with yourself. I believe that if there is a chance, you will have a special manner to introduce you how to use CodeWarrior to write MIDlet. Motorola J2ME SDK comes with the part of the appendix to make a simple introduction to the use of CodeWarrior developed MIDlet, I believe it is quite enough for beginners. The Motorola J2ME SDK contains three auxiliary development tools in Motorola J2ME SDK, which can facilitate our program development, which are: J2ME Simulator (J2ME Emulator) allows you to be on your PC The simulation of Motorola will support J2ME mobile phone devices. This can be directly tested on the PC directly on the PC. Bytecode Verifier This validator is used to verify Bytecode in the classfile, which is not illegal to the memory. And confirm that all thections made by the type file loaded into the virtual machine are in line with the Java Virtual Machine Specification. Configuration Editor allows you to create or modify Device Profile. In the documentation included in Motorola J2ME SDK, the three tools have been described in detail, and the author will not go to it later. Summarize the call! Good tired, finally arrived at this summary! Do you think that MIDLET is ended like this? No! MIDET also has a lot of fun! We will be more deep in this series. Discuss the MIDlet. Let's see it next time. Appendix: Example Program Motorola J2ME SDK attached to many interesting examples, where they are located under the Demo / MIDlets / directory. Readers who are interested in continuingly can learn more about MIDLET, because of these examples of execution pictures, they will omit them, please readers to refer to the documentation. Examples of these procedures: Bouncecom.mot.j2me.midlets.bounce.BouncePaddleBallcom.mot.j2me.midlets.paddleball.PaddleBallScribblecom.mot.j2me.midlets.scribble.ScribbleFontDemocom.mot.j2me.midlets.tutorials.FontDemoGraphicsDemocom.mot.j2me .midlets.tutorials.GraphicsDemoRecordStoreDemocom.mot.j2me.midlets.tutorials.RecordStoreDemoUDP Tutorial Applicationcom.mot.j2me.midlets.tutorials.UDPReceiveAlertTestcom.mot.j2me.midlets.tests.AlertTestChoiceGroupTestcom.mot.j2me.midlets.tests.ChoiceGroupTestDateFieldTestcom.mot .j2me.midlets.tests.DateFieldTestFormTestcom.mot.j2me.midlets.tests.FormTestGaugeTestcom.mot.j2me.midlets.tests.GaugeTestKeyEventsTestcom.mot.j2me.midlets.tests.KeyEventsTestTextBoxTestcom.mot.j2me.midlets.tests.TextBoxTestTextFieldTestcom.mot .j2me.midlets.tests.textfieldtesttickertestcom.mot.j2me.midlets.tests.tickertest

Author Blog: http://blog.9cbs.net/cooled/

related articles

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

New Post(0)