JDK1.7 Linux (Ubuntu) installation

Source: Internet
Author: User

First, installation JDK

    1. Download the JDK from Oracle website for Linux Systems (official website address: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html);
    2. To switch the system login account to root, the command is as follows:

sudo su

3. Create the Java installation directory and create the following commands:

sudo mkdir/usr/local/java

4. Copy the downloaded JDK package to the new Java directory with the following command:

CP Jdk-7u55-linux-i586.tar.gz/usr/local/java

5. Go to the Java directory, unzip the package into the Java directory, and unzip the command as follows:

Cd/usr/local/java

sudo tar xvf jdk-7u55-linux-i586.tar.gz

6. After the decompression is complete, the compressed package can be deleted, the command is as follows:

sudo rm jdk-7u55-linux-i586.tar.gz

Second, Configuration JAVA Environment Variables

    1. Modify the/etc/environment configuration file, open the Environment file by command "sudo gedit/etc/environment", add java_home and Classpath variables, and add the JDK installation path to the path path, which is added to the JDK Bin directory. The configuration file is similar to the following content;

Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games: $JAVA _home/ Bin"

    Export classpath=.: $JAVA _home/lib: $JAVA _home/jre/lib

Export java_home=/usr/local/java/jdk1.7.0_55

2. After the error is added, execute the configuration file with the command "source/etc/environment" to make it effective, and determine if the setting is successful, and view its path contents through the "Echo $PATH, Echo $CLASSPATH, echo $JAVA _home" command. ;

3. When the terminal enters "Java-version", the following prompt is displayed:

The program ' Java ' is already included in the following packages:

* DEFAULT-JRE

* Gcj-4.6-jre-headless

* Gcj-4.7-jre-headless

* Openjdk-7-jre-headless

* Openjdk-6-jre-headless

Please try: sudo apt-get install < selected packages >

In this case, you also need to modify the configuration file "/etc/profile", also by the command "sudo gedit etc/profile" Open the configuration file, at the end of the file to add the following:

    #set Java Environment

Java_home=/usr/local/java/jdk1.7.0_55

Export JRE_HOME=/USR/LOCAL/JAVA/JDK1.7.0_55/JRE

Export classpath=.: $JAVA _home/lib: $JAVA _home/lib: $CLASSPATH

Export path= $JAVA _home/bin: $JRE _home/bin: $PATH

Modify and save, execute the command "Source/etc/profile", and after successful execution, verify that the configuration is in effect by java–version. If the following is displayed, the configuration is proven to be in effect and the system is restarted.

Java Version "1.7.0_55"

Java (TM) SE Runtime Environment (build 1.7.0_55-b13)

Java HotSpot (TM) Client VM (build 24.55-b03, Mixed mode)

Third, installation Eclipse

    1. Download the version of the applicable Linux system on the Eclipse website;
    2. Unzip the eclipse into the specified directory (for example:/usr/local/java) and unzip the command as follows:

sudo tar xvfz eclipse-jee-kepler-sr2-linux-gtk.tar.gz/usr/local/java

3. Go to the extracted Eclipse directory and use the command "./eclipse" to open eclipse;

4. Create a new document on the desktop and enter the following:

[Desktop Entry]

Categories=development;

comment[zh_cn]=

Comment=

Exec=/usr/local/java//eclipse/eclipse

Genericname[zh_cn]=ide

Genericname=ide

icon=/usr/local/java/eclipse/icon.xpm

Mimetype=

Name[zh_cn]=eclipse

Name=eclipse

Path=

Startupnotify=true

Terminal=false

Type=application

X-dbus-servicename=

X-dbus-startuptype=

X-kde-substituteuid=false

X-kde-username=owen

Save the file as Eclipse.desktop, you can open eclipse directly on the desktop, and right-click the eclipse.desktop file to increase permissions. Such as:

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.