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.0rc2Http://www.eclipse.org
Eclipseme0.4.1Http://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:
Package com. paulsjavateks. instantj2-chapter1;
Import javax. microedition. MIDlet .*;
Import javax. microedition. lcdui .*;
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?
Additional instructions (1)
Recently, some netizens have encountered the problem that the agent cannot work normally after installing the plug-in, and the problem that the j2_options cannot be found in preference. If you are using eclipseme0.5.0 or earlier versions, refer to the solution below.
Then, we should see that there is a j2e-snapshot. Now, shut down eclipse.exe, change the name of the eclipsefolder, and then open eclipse.exe. Now everything is ready. Now we can see that we can set it according to the text.
Additional instructions (II)
The plugin installation method has changed after eclipseme0.5.0. You can refer to the following solution
Open eclipse, help-> Software Update-> Find and install...
Select "search for new features to install"-> next
Click "New archived site...", and then select the 0.5.5 ZIP file> OPEN button.
Next, just follow the prompts to "Next" "Next"... OK!
If you think the above method is not detailed enough, you can refer to its document link:
Http://eclipseme.sourceforge.net/docs/installation.html