Install JDK in Ubuntu 10.10 and configure eclipse to configure

Source: Internet
Author: User

 

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, separate it with a colon)
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 java /usr/local/lib/jdk1.6.0_24/bin/java 300$ sudo update-alternatives --install /usr/bin/javac javac /usr/local/lib/jdk1.6.0_24/bin/javac 300

//In opensusesudo /usr/sbin/update-alternatives --install "/usr/bin/java" "java" "/usr/local/lib/jdk1.6.0_24/bin/java" 40000

sudo /usr/sbin/update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/lib/jdk1.6.0_29/bin/javac" 40000

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 = new form ("another Hello World ");
17. Form. append ("Hello world! ");
18. display. setcurrent (form );
19 .}
20 .}
Running successfully ~

 
2011-3-7

Related Article

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.