Configure the MyEclipse environment in Ubuntu

Source: Internet
Author: User
Jdkhttp: // response

Jdk http://download.Oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz.

I installed jdk in/opt/java, so the following code is executed in the Terminal window:

Sudo mkdir/opt/java

Sudo tarzxvf jdk-7-linux-i586.tar.gz-C/opt/java

1. Open/etc/environment in the editor.

Gedit/etc/environment

2. Modify the file

PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: usr/games: $ {JAVA_HOME}/bin"

JAVA_HOME =/opt/java/jdk1.7.0

JRE_HOME =$ {JAVA_HOME}/jre

CLASSPATH =. :$ {JAVA_HOME}/lib: $ {JRE_HOME}/lib"

3. Open the bashrc File

Sudo gedit ~ /. Bashrc

4. Add the following code:

Export JAVA_HOME =/opt/java/jdk1.7.0

Export JRE_HOME =$ {JAVA_HOME}/jre

Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib

Export PATH =$ {JAVA_HOME}/bin: $ PATH

5. Reload bashrc

Source ~ /. Bashrc

6. Configure the default JDK version: Ubuntu may have a default JDK, such as openjdk. To set the JDK we installed as the default JDK version, perform the following Configuration:

Sudo update-alternatives -- install/usr/bin/java/opt/java/jdk1.7.0/bin/java 300

Sudo update-alternatives -- install/usr/bin/javac/opt/java/jdk1.7.0/bin/javac 300

Sudo update-alternatives -- install/usr/bin/jar/opt/java/jdk1.7.0/bin/jar 300

Sudo update-alternatives -- install/usr/bin/javah/opt/java/jdk1.7.0/bin/javah 300

Sudo update-alternatives -- install/usr/bin/javap/opt/java/jdk1.7.0/bin/javap 300

7. Then execute:

Sudo update-alternatives -- config java

Sudo update-alternatives -- config javac

Sudo update-alternatives -- config jar

8. Check whether the environment is properly configured

Java-version

Java version "1.7.0"

Java (TM) SE Runtime Environment (build 1.7.0-b147)

Java HotSpot (TM) Server VM (build 21.0-b17, mixed mode)

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.