Environment: Ubuntu10.10 download tool: jdk, version is jdk-6u23-linux-i586.bin. (Baidu: oracaljavaeclipse, eclipse-java-helios-sr2-linux-gtk.tar.gz 1. Jdk manual installation of the new can not be installed, the sudoapt-getsun-java6-jdk can not, only manually download the jdkTerminalcd to enter the downloaded jdk folder, and then
Environment: Ubuntu10.10
Download tool: jdk, version: jdk-6u23-linux-i586.bin. (Baidu: Marshal java)
Eclipse, eclipse-java-helios-sr2-linux-gtk.tar.gz
1. Install jdk manually
The new cannot be installed, sudo apt-get sun-java6-jdk can not, only manual
Download jdk
Terminal
Cd to enter the downloaded jdk folder, and then run the cp command to copy the file to/usr/local/lib
Then execute
Sudo chmod + x jdk-6u24-linux-i586.bin
Sudo./jdk-6u24-linux-i586.bin
After the last command is executed, a "JDK 1.6.0 _ 04" directory is added under the current directory, which is all the JDK files after the jdk-6u4-linux-i586.bin is decompressed;
Configure Environment Variables
$ Sudo gedit/etc/environment
Write the following two lines in the Text Editor:
PATH = "/usr/local/lib/jdk1.6.0 _ 24/bin" (if it already exists, use Mao Hao to separate it)
CLASSPATH = "/usr/local/lib/jdk1.6.0 _ 24/lib"
JAVA_HOME = "/usr/local/lib/jdk1.6.0 _ 24"
Because ubuntu may have a default jdk, such as openjdk, we need to perform the following work to make the jdk installed by default.
Run
$ Sudo update-alternatives -- install/usr/bin/java/usr/local/lib/jdk1.6.0 _ 24/bin/java 300
$ Sudo update-alternatives -- install/usr/bin/javac/usr/local/lib/jdk1.6.0 _ 24/bin/javac 300
In this step, add the installed jdk to the java menu.
Then execute
Code:
Update-alternatives -- config java
In this step, select the default jdk
Log out, Terminal, and run java-version. Display:
Java version "1.6.0 _ 24"
Java (TM) SE Runtime Environment (build 1.6.0 _ 24-b07)
Java HotSpot (TM) Client VM (build 19.1-b02, mixed mode, sharing)
Configuration successful.
Install eclipse
Download the file, decompress it, and copy the file to the java directory.
Sudo mv/home/empty/download/eclipse/usr/local/lib/
Double-click eclipse to go to the next step .... OK
Or
Terminal
Sudo apt-get eclipse-palmform
Configure
1. Download sun wtk (Wireless Toolkit)
Http://java.sun.com/products/sjwtoolkit/download.html
2. Install SUN WTK
#./Sun_java_wireless_toolkit-2_5_2-linux.bin
Terminal command:
1). Enter the bin directory
2). Execute the command: sudo chmod + x/usr/local/sun_java_wireless_toolkit-2_5_2-ml-linux.bin
(Grant the current user the permission to run the. binfile)
3). Execute the command: sudo./sun_java_wireless_toolkit-2_5_2-ml-linux.bin (for installation)
Sudo rm sun_java_wireless_toolkit-2_5_2-ml-linux.bin (delete installer)
Copy eclipseme.feature_1.6.8_site.zip to the Eclipse root directory.
Then start installing the "j2_plug-in compressed package": Help-> SoftwareUpdate-> Find and Install-> Search for new features to install-> New Archived site... -> Select “eclipseme.feature_1.6.8_site.zip, and click "Open"-> OK-> finish-> next-> Accept... -> Next-> All Install... -> Yes. Restart Eclipse.
4. Configure WTK in Eclipse
Start Eclipse, Window-> Preferences to enter the Configuration Window.
Select the j2-based menu and enter the WTK installation directory in the WTK Root file.
J2-> Device Management-> Import, set the directory item to/home/user/homework/WTK2.2/bin, and Refresh the Refresh button,
Confirm Finsh and select your preferred mobile phone skin.
Complete the following configurations in the WTK installation directory:/home/user/homework/WTK2.2. Done!
Test procedure:
New project-> j2e-sre new class "Hello"
1. import javax. microedition. lcdui. Display;
2. import javax. microedition. lcdui. Form;
3. import javax. microedition. midlet. MIDlet;
4. import javax. microedition. midlet. MIDletStateChangeException;
5. public class Hello extends MIDlet {
6. Display display;
7. public Hello (){
8. super ();
9. display = Display. getDisplay (this );
10 .}
11. protected void destroyApp (boolean arg0) throws MIDletStateChangeException {
12 .}
13. protected void pauseApp (){
14 .}
15. protected void startApp () throws MIDletStateChangeException {
16. Form form = new Form ("Another Hello World ");
17. form. append ("Hello World! ");
18. display. setCurrent (form );
19 .}
20 .}
Running successfully ~