Because the eclipseme version was relatively low at the time of writing this article, but after 0.5 (if I remember correctly), the installation method changed. As of 11.18, the latest version should be 0.6.1, if you install a later version, refer to the following Connection article,
Http://www.j2medev.com/Article_Show.asp? Article ID = 144 for 0.4.x, refer to this article.
Since wtk does not provide the code editing function, this article describes how to use eclipse to build a j2-based development environment. After reading this article, you will be able to use j2sdk1.4.2 _ 03 + wtk2.1 + eclipse3.0rc2 + eclipseme0.4.1 for the development of j2ssdk1.4.2. Hope it will be helpful for new users.
- You should download the relevant software from the following address.
J2sdk1.4.2 _ 03 + wtk2.1: http://java.sun.com
Eclipse3.0rc2 http://www.eclipse.org
Eclipseme0.4.1 http://sourceforge.net
- Install j2sdk1.4.2 _ 03, wtk2.1, eclipse3.0rc2, and eclipseme0.4.1 in sequence. After j2sdk is installed, set environment variables such as classpath, path, and java_home. After setting, you can write a test program helloworld. Java for testing. Enter javac helloworld. Java in the command line to get the class file, and enter Java helloworld to output Hello World on the screen, which indicates that j2sdk is correctly installed.
Public class helloworld
{
Public static void main (string [] ARGs)
{
System. Out. println ("Hello World ");
}
}
Next, install wtk2.1, which is the same as general application installation. After installation, you can run some demos in wtk2.1 from the ktoolbar. If wtk is correctly installed, we need to build the eclipse development environment. Eclipse installation is very simple, you can directly extract eclipse3.0rc2 to C:/eclipse. Run eclipse.exe directly so that you can see the eclipse running interface. If you have never used eclipse, you can take a look at the help documentation and run it on your own as a small Java project. Next, we will install the eclipseme.0.4.1 plug-in. Close eclipse and decompress eclipseme0.4.1 to C:/Eclipse/plugin. Restart eclipse and choose windows> preferences to configure the j2's development platform.
Choose platform components-> wireless toolkits, right-click and choose add wireless toolkit. The following interface appears.
Select the installation path of your wtk, and select OK. Then you have set up the development platform of j2-based architecture. Since cldc/MIDP can be flexibly configured, you can also create other platforms to use other simulators. For more information, see the help documentation in eclipseme.
- Next we will create a new small project to illustrate how to use it to develop the j2's project, select File-> New-> others-> j2's-> j2's MIDlet suite, and enter the project name such as helloworld, select the next step to complete, so that we have created a new j2_project.
Next, select the project helloworld from package explorer and create a new j2midlet named hellomidlet.
Then the code is edited. The content of the Code is as follows:
/*
* Hello. Java
*
* Created on August 26,200 1, PM
*/
Package com. paulsjavateks. instantj2-chapter1;
Import javax. microedition. MIDlet .*;
Import javax. microedition. lcdui .*;
/**
*
* @ Author paul_tremblett
* @ Version 1.0
*/
Public class Hello extends MIDlet {
Private display;
Public Hello (){
Display = display. getdisplay (this );
}
Public void Startapp (){
Textbox T = new Textbox ("Hello MIDlet", "Hello MIDP! ", 256, 0 );
Display. setcurrent (t );
}
Public void pauseapp (){
}
Public void destroyapp (Boolean unconditional ){
}
}
Select Run> run from the menu to configure the runtime environment.
After setting, click Run. If not expected, the program runs normally and the following interface is displayed.
OK. This is the introduction of how to set up the development environment of the j2_based architecture. In fact, the best way to get familiar with it is to install it immediately and then start writing program tests. Practice is the best teacher, isn't it?