Use eclipseme to develop the j2e-hpc Program

Source: Internet
Author: User
This article describes how to use the eclipseme plug-in Eclipse IDE to develop a j2_application. This article first introduces the eclipseme plug-in and its installation and configuration steps, and introduces how to build a basic J2EE application through a simple example.

I. installation and configuration preparation

You need to install eclipse 3.0m9, j2wireless toolkit 2.1, and eclipseme. Eclipse is an open-source IDE development environment funded by IBM. Eclipse is attracting more and more developers. The j2e-wireless toolkit 2.1 provides libraries and Simulators required to run the j2e-based applications. The eclipseme plug-in allows developers to easily develop j2s applications in the eclipse environment.

1. Install
(1) download eclipse v3.0m9 from the eclipse web site. You can install it by compressing it to any selected directory (called eclipse_home in this article.
(2) download the j2_wireless toolkit 2.1 from Sun's website. You can install it in any selected directory (this directory is called wtk_home in this article ).
(3) download eclipseme plug-in V 0.4.5 from SourceForge. You can install eclipse_home/Eclipse/plugins by Decompressing it.
(4) download j2se SDK from Sun's Web site. You can install it in any selected directory (this directory is called java_home in this article. In this article, the j2se SDK version is v1.4.2.

2. Configure the eclipseme plug-in
To configure the eclipseme plug-in, follow these steps:

(1) Start eclipse.
(2) configure the eclipseme plug-in. To implement this function, click the "window" menu, select the "Preferences" menu item, and then select "J2EE" in the pop-up menu ". Perform the following steps:

☆Click "platform components", as shown in figure 1.
☆Right-click "wireless toolkits" in the right window and select "add wireless toolkit". The window is displayed (see figure 2). "wireless toolkit directory" is set to the installation directory corresponding to wtk_home.


Figure 1 eclipseme plug-in configuration page

 
Figure 2 add wireless Toolkit

3. After the installation is complete, the page 3 appears.


Figure 3 configure eclipseme Plugin-final result

2. Develop a j2_application

In this section, we will introduce the basic steps for using the eclipseme plug-in to build a J2EE application. First, you will create a J2EE project. Then, you can start your journey to the Development of j2s.

1. Create a J2EE Project
Go back to the "file" menu, select "new", and select "project" from the sub-menu ". Perform the following steps:

(1) go to the "agent" option, select "Agent suite", and click "Next" (see Figure 4 ).
(2) Fill in the project name and click "Next" (see Figure 5 ).
(3) Select a possible platform definition. You can select "j2mwireless toolkit 2.1 midp1.0 platform" or "j2mwireless toolkit 2.1 midp1.0 platform". The default value is the former. (See figure 6 ).
(4) Click "Next" to see the configuration related to the j2_project. Here we use the default settings (see figure 7 ).
(5) Click "finish" to complete project creation.

Result 8 shows the creation of the final j2_project.


Figure 4 Create a J2EE project-Step 1

 
Figure 5 create a J2EE project-Step 2


Figure 6 create a J2EE project-Step 3


Figure 7 create a J2EE project-Step 4


Figure 8 create a j2_project-final result

2. Develop the j2_project
Go back to the "file" menu, select "new", and select "other" from the sub-menu ". Perform the following steps:

(1) go to the "agent" option, select "Agent", and click "Next" (see figure 9 ).
(2) fill in the Application name. Use the default settings for other settings, and click "finish" (see Figure 10) to create the application.


Figure 9 create a J2EE application-Step 1


Figure 10 create a J2EE application-Step 2

The system automatically generates the helloworld. Java program and a piece of automatically generated code. For the final program code, see List 1.

Listing 1. helloworld. Java

/**
* Helloworld. Java
*
* @ Author Wanhui
*/
Import javax. microedition. lcdui. display;
Import javax. microedition. lcdui. textbox;
Import javax. microedition. MIDlet. MIDlet;
Public class helloworld extends MIDlet {
Private textbox;
/**
* Constructor of the helloworld class
*/
Public helloworld (){
Textbox = new Textbox ("", "Hello world! ", 20, 0 );
}
/*
* The Startapp method is used for starting or restarting a MIDlet.
*
* @ See javax. microedition. MIDlet. MIDlet # Startapp ()
*/
Public void Startapp (){
Display. getdisplay (this). setcurrent (textbox );
}
/*
* The pauseapp method is called by the system to ask a MIDlet to "pause"
*
* @ See javax. microedition. MIDlet. MIDlet # pauseapp ()
*/
Public void pauseapp (){
}
/*
* The destroyapp method is called by the system when the MIDlet is about
* Be destroyed
*
* @ See javax. microedition. MIDlet. MIDlet # destroyapp (Boolean)
*/
Public void destroyapp (Boolean unconditional ){
}
}

3. Run the J2EE Application
To run a J2EE application, select an application, which is helloworld in this article. java, then return to the "run" menu, select the "run as" item, and select "1 emulated j2midlet" in the sub-menu ". Then eclipse starts the simulator in the j2e-wireless toolkit 2.1 to obtain the running result, as shown in Figure 11.


Figure 11 result

Conclusion
In this article, we introduce how to use the eclipseme plug-in the Eclipse IDE development environment to develop the J2EE program. You have learned how to create a simple J2EE application in the eclipse environment.

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.