Introduction to Kjava
Kjava's name is from the KVM virtual machine, which refers to a Java platform solution for resource-dependent resource-based resource-based resource-based resources-oriented. Since the mobile Internet business is more focused on the application on the mobile phone, the Java app is referred to as KJAVA is more exact. Kjava has a platform for open and easy dynamic downloading, which enables third-party developers to develop KJAVA applications for handheld devices. If a mobile phone supports kjava, then its function is scalable. After the service developer develops value-added applications, the user can download it to the mobile phone. Since Kjava has a wealth of development interface, service developers can develop functional complicated applications, and the user's operation is more convenient, and the interface is more vivid. Use Kjava to develop applications for mobile phones, generally available interactive games, screen protection, stock inquiry, electronic map service, photo editing, personal information processing, etc.
2 Kjava application development
The development of KJAVA applications is generally taken by the following steps: first to download and install the development tool. The usual Java development tool can also be used to develop KJAVA applications, but due to KJAVA's characteristics, it is advisable to adopt a dedicated development tool. Common development tools have: § Command line-based tools: Motoj2SDK (Motorola) and JDK 1.3 (Sun) WTK (Sun) And JDK 1.3 (Sun) § Ide-based Tool: Forte and Wtk http: //java.sun. Com Metrowerks CodeWarrior 6.0 for J2ME http://www.metrowerks.com/ jcreator and motoj2sdk http://www.jcreator.com Wireless Toolkit http://java.sun.com/products/j2mewtoolkit/ Use these development tools, you can Edit the source program (* .java) and compile (* .class). It is usually trial running in the simulation environment of the tool to confirm that the program is correct after compiling. The final archive generation is available for downloading the KJAVA application (* .jar). Below to develop a HelloWorld applet as an example, briefly introduce the steps of kjava application development. The tool used is the command line-based Motoj2SDK. (1). Editing the source program storage directory to D: / Motoj2sdk / demo / midlets / com / mot / midlets // ** * HelloWorld.java * June 27, 2002 * / package com.mot.midlets.tutorials; import javax.microedition.lcdui . *; import javax.microedition.midlet *;. / ** * A simple Hello World midlet * * @see MIDlet * / public class HelloWorld extends MIDlet {/ ** * Main application screen * / private Form mainScreen; / ** * A reference to the Display * / private Display myDisplay; / ** * Creates a screen for our midlet * / HelloWorld () {myDisplay = Display.getDisplay (this); mainScreen = new Form ( "Hello World"); / * * Create a string item * / stringItem strItem = new stringItem ("Hello", "this is a j2me midlet."); Mainscreen.append (stritem);} / ** * start the midlet * / public void StartApp () THROWS MIDletStateChangeException {myDisplay.setCurrent (mainScreen);} / ** * Pause the MIDlet * / public void pauseApp () {} / ** * Called by the framework before the application is unloaded * / public void destroyApp (boolean unconditional) {} }(2). Compile source program
In the command line window, enter the directory D: / Motoj2SDK / DEMO / MIDLETS / COM / MOT / MIDLETS / Enter "CompileAll COM / MOT / MIDLETS / TUTORIALIALS / HELLOWORLD.JAVA" (3). Simulation trial operation
In the command line window, enter the directory D: / Motoj2SDK / Scripts / Enter "Runemul Com.mot.midlets.Tutorials.HelloWorld"
(4). Generate Manifest files
In the command line window, enter the directory D: / Motoj2SDK / DEMO / MIDLETS / Enter "Meta-INF" Note: "Meta-Inf" must be capitalized
(5). Generate compressed Java file files
In the command line window, enter the directory D: / Motoj2SDK / DEMO / MIDLETS / Enter "JAR CVFM HelloWorld.jar meta-inf / manifest.mf COM / MOTO / MIDLETS / CALC / *. Class" After these steps, one The KJAVA program has been successfully developed for downloading to the phone.
3. Develop some design strategies that Kjava applications should follow
As developing any other application, in order to minimize hardware resources and get the best performance, you should pay attention to the following design strategies: 1. The maintenance program is simple, the smaller the program, the better. Because the smaller the machine, the less memory is less, the less installed. Use the scalar type instead of the object type for the memory occupied by the runtime. At the same time, it does not rely on garbage collection procedures. You should use the object reference to you, which can manage memory. Another method of reducing the memory required is to instantiate "inert", which is only assigned to the object only. 2. Let the server do most of the work. Put the computed tasks on the server, allow your mobile device to process the interface and the least calculation work, and let the server do heavy work. 3. Use a local variable. Access local variables faster than access group members. 4. Avoid string series. String series not only reduces performance, but also adds the application's memory peak occupancy. 5. Use threads to avoid synchronization. Any running time exceeds 1/10 seconds requires a separate thread. Avoid synchronization can also improve performance. 6. Use the Model View Controller (MVC) to separate the model. The MVC separated the logic displayed in the code.
4. Kjava mobile phone
At present, there are Siemens 6688i, Motorola A6288 / 388, Nokia's 9210, etc., and the KJAVA program of mobile phones is different, but always use a Kjava app, need to have 3 steps: (1), Download: Different mobile phones have different downloads, such as downloading through the WAP web page, downloaded through the serial port data lines through the serial port data line. The following uses the Motorola 388 to download as an example of Kjava application download: connect the mobile phone and PC serial port with the data line provided by the mobile phone, select the "Download" menu option on the mobile phone, and then provide one by Motorola 388 Downloading tools for PCJAL.EXE can easily download the Kjava program on the PC.
(2), install: After the general mobile phone is loaded with a KJAVA program, it will be automatically installed. Store the program in the specified location of your phone. (3) After running: After the program is installed, the phone will display the app in the program menu, and the user can run the program after the user setes the menu item.
5. Kjava mobile phone application prospect
The application of Kjava mobile phone in China has just started. In Japan, several mobile operators headed by NTT DoComo have launched Kjava applications, and Kjava features a mobile phone is an indispensable function. Taking Japan NTT Docomo's Kjava service as an example, JAVA mobile phone service was launched on January 26, 2001. 2.30,000 mobile phones were sold in the first week. By 27, 2002, users have reached 11.2 million. It launched a service provider with 36 content providers, about 80% of the content is entertaining, and in May 2001, it has exceeded 5,000 applications. The Kjava mobile phone service is so hot in Japan, it is necessary to start from the interface of the mobile phone. The current mobile phone is a closed operating system unless the manufacturer's own software and tools cannot be changed to the mobile phone menu, not to say it on the mobile phone. Additional application is attached. The benefits of Kjava lies in providing a relatively open platform, mobile phone users can download software to expand mobile phones on the phone, and its application support graphics, which allows the mobile phone interface to completely exceed text-based static content services. For example, the mobile phone stocks are now transmitting information, and the information is not rich enough, and Kjava's application software can realize graphical analysis such as K-line map, so that the technology of mobile stocks has essentially leap. Questions & Answers about Kjava: http://www.ucanmms.com/kjavapage03.htm