Configuration of Nokia 7210 (zt)

Source: Internet
Author: User
I. Introduction

Recently, a friend suggested whether to write some articles on the j2_related programming. I thought I had a good time sorting out my work recently. I saw someone asking about this tutorial on the Internet that day, so I agreed that I could sum up what I learned systematically, I also hope that I can give some reference to my friends and colleagues who love and learn j2s. I hope I can bear with me!

II. Introduction

The Java 2 platform and the pocket edition (Java 2 platform, Micro Edition (j2s) are developed by Sun after j2se and J2EE, it is committed to the best solutions for consumer products and embedded devices. All embedded devices are divided into two types: one is embedded devices with limited computing functions and limited power supply (such as PDAs and mobile phones ); the other is embedded devices with relatively better computing capability and ample power supply (such as air conditioners, refrigerators, and set-top boxes )). Because of these two differences, Java introduces a concept called configuration, and defines the embedded devices with limited computing functions and limited power in the connected limited device configuration (cldc) specification; the other device specification is the connected device configuration (CDC) specification. In other words, the concept of configuration is separated into two abstract types by all embedded devices. The MIDP layer, mobile information device profile (MIDP), is a Java API set that handles issues such as user interfaces, persistent storage, and networking. A prerequisite for j2-cldc is a compact JVM called K Virtual Machine (KVM )). KVM is designed for network connection devices with small memory and limited resources.

Iii. Development Trends

In our daily life, personalized smart information products are already essential. These products include mobile phones, two-way pagers, smart cards, personal organizer, and palmtop ). Their trend is to become a target-specific, resource-limited network connection device, rather than a general desktop that we have known so far. Specifically to meet this huge consumption space, Java 2 platform's pocket edition (j2s) provides a lot of innovative Java technologies. Its application in mobile phones is one of the most convincing proofs. Nokia, Motorola, Siemens, and other major mobile phone manufacturers around the world have developed a variety of mobile phone models that support j2's. What is the market potential? Taking China as an example, according to the survey, China's mobile users nearly 0.3 billion (http://arch.pconline.com.cn/news/dxgd/10211/108337.html), such a large base, showing its strong demand.

Iv. Development and configuration

After we have a preliminary understanding of j2's, we should start the development of the j2's program. To do something better, you must first sharpen the tool. To learn how to configure it, you must start with the configuration. Otherwise, helloword does not know how to get it. Here, I will take the Nokia simulator as an example to talk about the configuration of wtk + Nokia and the configuration of JBuilder + mobileset + Nokia.

4.1 Nokia simulator configuration: Sun j2wireless toolkit + Nokia 7210

1. First install wtk, the relevant resources can be downloaded on the http://www.cnjm.net, this example assumes that the installation in C:

2. Install the Nokia simulator in the Device directory of wtk (C:/j2mewtk/wtklib/devices)

3. Open ktoolbar.exe or ktoolbar. bat in the BIND directory of the wtkdirectory, and the running interface of wtk appears (a DOS window appears when ktoolbar. bat is opened). We mainly use the six buttons in the second row:

A new project

Purpose: To create a j2-based project, you are required to enter the project name and the project's MIDlet main class. After that, you have created a new j2_project. You will find the folder of your new project in the apps (C:/j2mewtk/apps) directory. In this folder (your project name), there are four folders (bin, Lib, res, Src ).

Binfile: the directory used to save the result file, including jar, Jad, and MF files.

JAR file: a Java compressed file package that contains all the class files and resource files required by the MIDlet project;
The descriptor file (JAD file) file is used to describe the basic information of a MIDlet suite and the MIDlet information contained in the MIDlet suite, for example, internal files such as category names, icons, and program names (stored in jar files );

Configuration file (nifest file, manifest. MF): similar to the content JAD file, it is used to describe the files of the MIDlet project. The difference is that it does not include the JAR file SRC Folder: place the Java source file

Res Folder: place the resource file bin Folder: place the target file, such as Jad, MF, and jar files.

B Open Project

Purpose: open an existing project, and then you will find that other options such as setting, build, run, and device are converted from Gray (unavailable) to black.

C setting

Perform some basic settings for an opened project. These settings are saved in the Jad descriptive file. This information is very important to your project. Click the setting button. In the Setting dialog box, there are four option columns:

Required: MIDlet-jar-size refers to the size of the JAR file; MIDlet-jar-URL refers to the current address of the JAR file, which is the JAR file name by default, it indicates that it is in the same path as the JAD file by default. If your MIDlet file is in Ota (over the air, it means downloading the MIDlet program from the Network) when publishing on the server, here your MIDlet-jar-URL needs to be modified and changed to the URL format address of the jar, such as: http ://
Ota.com.cn/path/yourjar.jar; MIDlet-name indicates the main Class Name of the MIDlet project.

MIDlet-vonder generally points to the company name. It is worth noting that the information is case-sensitive.

Optional: optional information, such as the project icon and text description.

I will not go into details here. You can check the relevant information.

User Defined: Here are some variables that you define from the outside in the program. They are of the key-value type. For example, you define: Key: key007, value: value007 (case sensitive ). In the program, you can use the getappproperty ("key007") of the MIDlet to get one.

String: value007

Midlets: the most commonly used icon. This icon is the image displayed in the mobile game menu. to delete or modify the icon, click the edit and remove buttons below.

Well, now we can use wtk + Nokia to do the j2's program. Using this configuration as a program is simple and practical for those who have used programming in other languages. Create your Java class in the src directory. If your j2s program uses images or other data, put it in the res directory. After the program is written, select your simulator in the device drop-down box and click the build button of wtk. If no error occurs, run and OK. It's easy! Simple things, of course, are flawed. Here you can use Notepad as the editor, ultra edit, or jcreator as the editor. I recommend using jcreator, which will prompt you an error in the Compilation Program. Of course, you still need to configure it, add the Nokia package to the compilation path. However, there is also an integrated development tool that makes it easier to compile, debug, and run the J2EE program, that is, the juilder + mobileset that I will talk about right away.

4.2 JBuilder + mobileset + Nokia Configuration

1. Install jbuilder8 (jbuilder8 is used as an example here. juilder7 is also supported. jbuilder9 has integrated mobileset ).

2. then install mobileset3.0. After installation, you will find an additional j2mewtk folder under the JBuilder root directory. Needless to say, this is Sun's wtk tool. You will see an extra micro page in files> New.

3. Install the Nokia 7210 simulator. We recommend that you install the 4.1 software in the Device directory of strongtk.

4. Configure JBuilder

Okay. Open jbuiler and register it. First, select option-> Configure jdks on the menu bar and you will find that the window on the Left bar contains a j2wireless toolkit 1 .. 0.4.01. This is the wtk mentioned above. OK. select it. If you want to use it to compile a mobile phone program based on the Nokia 7210 simulator, you also need to add the API package for Nokia compilation in the lower-right class white box. Select the Add button. In the select one or more derictorys dialog box, select classes.zip in the libpackage of the installation directory of your Nokia simulator, and then click OK. Then select your simulator on the micro page. Here is the Nokia 7210 simulator.

5. Create a new project, enter the project name, and select the project placement location to finished. Now, files-> New, select the MIDlet on the micro page to create a new MIDlet class. Generally, in the MIDlet wizard bar, enter the MIDlet name and package name (leave it blank if no package is required ). Another way is to have the src directory under your project directory. You can first create the src directory under the src directory (if not, create your own src directory. If yes, copy it) create a Java file as the main class name of your project, that is, MIDlet ..
Note: If you have the project source code, you can directly copy the source code to the src directory.

Now let's configure how to use the Nokia simulator in JBuilder.

Open JBuilder, tools-> Configure JDK. In this dialog box, select JDK as the j2e-wireless toolkits, and click OK.
If you select "micro" in the files-> "new" dialog box to create a MIDlet class, JBuilder automatically creates its configuration for you. If you do not do this, you need to set it yourself. In JBuilder, select the project and choose Project> project properties from the menu bar. In the Project Properties dialog box, on the path page, select JDK, click the next button, and select a JDK, select the j2e-wireless toolkit 1.0.4.01 and click OK. Click the run page. If it is used for the first time, it will be blank. Then, select the new button and a dialog box appears, this is an important configuration dialog. Detailed configuration instructions are as follows:

// N7210_jme_sdk_v1_0
Name // enter your project name
On the run page,
Type // specifies the type of your project. A MIDlet option is displayed in the drop-down list.
// If you do not see it, the mobileset installation error occurs. Please reinstall it .)
If you select MIDlet, the following page is changed. Here we only need to set two items
Main class // select the main class of the project. You can find the main class name in both Brower and search. If not,
// Create a main class Java file in the src directory of the project
Emulator device // select the simulator you want to use and the Nokia Simulator

Now the settings are complete! You can test it! Okay, let's take a look.

4.3 test whether the configuration is successful

Open the project you just created, and you may find a displayable. java. I suggest you delete this Java class, with only one primary MIDlet class left. The modifications are as follows:

1. Delete

Private displayable2 displayable = new displayable2 ();

2. Use the following code:

Form from = new form ("helloworld", null );
Display. getdisplay (this). setcurrent (displayable );

Replace

Display. getdisplay (this). setcurrent (displayable );

OK, it's so simple. After compilation and running, the red Nokia Simulator Interface will pop up, and an empty form interface named helloworld will finally appear. Congratulations! You have succeeded!

Note: 1. If you want to use JB for a j2-based project and use images or other resources, you need to put these resource files in the classes folder.

2. If an exception or compilation error occurs, the configuration above is incorrect. Open your project properties and re-check your settings. The main focus is on JDK configuration and run configuration.

V. Development of j2's programs

The development of the Java program requires solid basic java skills. Many interfaces and methods of the j2se microversion and simplified version are not very complex. It has simple inheritance relationships, including basic advanced UI components and relatively free canvas.
Its unique feature is its micro-database RMS. All of this requires you to understand and study it carefully. Due to the limited length, we will not detail the specific j2-based programming here.

6. Post on j2's

In fact, I personally think that it is relatively easy to develop a program for j2s. As long as you have basic java knowledge and are familiar with the API for j2s, it will be easy to get started, the most difficult thing is to start learning. Including configuration, compilation, and running. I had a deep understanding when I was a beginner (I started to learn by myself ). So I wrote these basic things, hoping to help them.

Currently, I have been engaged in this field of work and research. However, I think that the prospect of j2-based architecture is very broad and not limited to games. mobile application software is also a very important aspect. With the development of science and technology, KVM has also made great progress, and it is certainly the expansion of the Application restrictions of j2s.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.