Ubuntu (4) install JDK and eclipse

Source: Internet
Author: User
1. JDK installation:
1. Download the Linux self-extracting file jdk-6u4-linux-i586.bin of JDK 6.0.4 from the sun site;
2. install and configure
CD/usr/local/lib
Sudo CP/home/jdk-6u4-linux-i586.bin ./
Sudo chmod + x jdk-6u4-linux-i586.bin
Sudo./jdk-6u4-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 files of JDK after the jdk-6u4-linux-i586.bin is decompressed;
2.2. Install configurations
CD/usr/local/lib
Sudo CP/home/jdk-6u4-linux-i586.bin ./
Sudo chmod + x jdk-6u4-linux-i586.bin
Sudo./jdk-6u4-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;
Unununtu itself carries the JVM Implementation of gij, so when you input "Java-version" in terminal, it will display:
Java version "1.5.0"
Gij (GNU libgcj) version 4.2.1 (Ubuntu 4.2.1-5ubuntu5)
. That is, there are two JVM implementations in the system, and gij JVM is also used by other Ubuntu tools or software. In this case, you must use the "Update-alternatives" tool provided by Debian to complete the process. Program Multiple versions are available:
Sudo Update-alternatives -- display Java
The system only lists gij JVM, because JDK 6 is manually decompressed and installed.
Enter the following two lines:
Sudo Update-alternatives -- install/usr/bin/Java/usr/local/lib/jdk1.6.0 _ 04/bin/Java 60
Sudo Update-alternatives -- install/usr/bin/Java/usr/bin/gij-4.2 40
Note that 60 and 40 at the end of 1 or 2 rows are the priority. Now, JDK 6 is set as the first choice;
Input: ls-L/etc/alternatives/Java. The JVM has pointed to the decompressed directory of JDK 6:
Lrwxrwxrwx 1 Root 35 2008-01-25/etc/alternatives/Java->/usr/local/lib/jdk1.6.0 _ 04/bin/Java
CD/usr/bin
Sudo CP Java. Bak
Sudo ln-SF/etc/alternatives/Java
Run the following command again:
Java-version
Java version "1.6.0 _ 04 ″
Java (TM) se Runtime Environment (build 1.6.0 _ 04-b12)
Java hotspot (TM) Client VM (build 10.0-b19, mixed mode, sharing)
To change the JVM implementation, enter:
Sudo Update-alternatives -- config Java
Configuration;

3. Set Environment Variables
Add the following content to/etc/profile:
Java_home =/usr/local/lib/jdk1.6.0 _ 04
Jre_home =/usr/local/lib/jdk1.6.0 _ 04/JRE
Classpath =.: $ java_home/lib: $ jre_home/lib
Export java_home jre_home classpath
Okey. JDK installation and configuration are complete.

2. Install Eclipse:
Download and decompress eclipse, and then
Add the eclipse link to Applications> programming:
Right-click applications, select Edit menus, select programming in the list on the left, and click new item. Type: application; Name: eclipse; command:/home/[your account name]/bin/Eclipse/eclipse
After saving, eclipse is installed.
If you are prompted that the Java VM (visual machine) is not found, enter the following in the terminal:
Ln-S $ jre_home ~ /Bin/Eclipse/JRE

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.