Ubuntu Configuration JDK Environment variables

Source: Internet
Author: User

This article is reproduced! Please refer to the original! Add your own parts to the changes!

1, to the official website download JDK7, find jdk-7u21-linux-i586.tar.gz and download: http://www.oracle.com/technetwork/java/javase/downloads/ Jdk7-downloads-1880260.html

2. After extracting the folder named Jdk1.7.0_21, copy it to/USR/LIB/JVM (new JVM folder is required).

  

3. Configure the JDK environment variables:

When you start the terminal and enter

Gedit/etc/profile  

  

Add the configuration at the end, save and exit

#set JDK Environment  export java_home=/usr/lib/jvm/jdk1.7.0_21  export classpath=.: $JAVA _home/lib: $JAVA _ Home/jre/lib: $CLASSPATH  export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH  

Terminal input command to make configuration effective

Source/etc/profile  

  

4. See if the configuration is successful. In the terminal input

Java-version

  

If the display version is 1.7.0.21, the configuration succeeds, as shown below:

Java version "1.7.0_21"  Java (tm) SE Runtime Environment (build 1.7.0_21-b11)  Java HotSpot (tm) Server VM (build 23. 21-B01, Mixed mode)  

  

If the display is still OPENJDK, perform step 5, test again

5, configure default Jdk,ubuntu under Default JDK is OPENJDK. Terminal input

sudo update-alternatives--install/usr/lib/java java/usr/lib/jvm/jdk1.7.0_17/bin/java  sudo Update-alternatives--install/usr/lib/javac Javac/usr/lib/jvm/jdk1.7.0_17/bin/javac 300  

  

Execute the following command to configure the default JDK

sudo update-alternatives--config java  

  

The JDK version is listed, which is labeled "*" as the default JDK. If you want to maintain the current default JDK, press ENTER directly, otherwise enter the number of the corresponding JDK to set it as the default version.

Ubuntu Configuration JDK Environment variables

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.