Ubuntu14.04 install JDK and ubuntu14.04jdk

Source: Internet
Author: User

Ubuntu14.04 install JDK and ubuntu14.04jdk

Download from Sun's official website

Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Select accept license, and then select JDK download suitable for your model.

Decompress the file and modify the file name.

sudo mkdir /usr/lib/jvmsudo tar zxvf jdk-8u11-linux-i586.tar.gz -C /usr/lib/jvmcd /usr/lib/jvmsudomv jdk1.8.0_11 java

Add Environment Variables

sudo vim ~/.bashrc

Add the following content

export JAVA_HOME=/usr/lib/jvm/javaexport JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH

Configure the default JDK version

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/bin/java 300sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/bin/javac 300sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java/bin/jar 300sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java/bin/javah 300sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java/bin/javap 300 

Then execute

sudo update-alternatives --config java

If JDK is installed for the first time, the system prompts There is only one alternative in link group java (providing/usr/bin/java ): /usr/lib/jvm/java/bin/java requires no configuration.

If it is not the first installation, JDK options of different versions will be available.

Test

java -version

If the java version information is displayed, the installation is successful.

 

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.