Debian/ubuntu under Installation Java8

Source: Internet
Author: User

Method of installation via Oracle-java8-installer:

http://blog.csdn.net/feelang/article/details/24425349

Installation through Oracle-java8-installer always fails

The installation traces need to be cleared after the failure:

    1. sudo rm/var/lib/dpkg/info/oracle-java7-installer*sudo apt-get purge Oracle-java7-installer*sudo rm/etc/apt/ sources.list.d/*java*


--------------------------------------------------------------------------------------------------------------- -

Then use the second method to download it directly from the official Oracle website

Download the JDK package installation directly (this is only about JDK7, the JDK8 principle is exactly the same)

Divided into the following 5 steps

1. Download the JDK on the website

2. Unzip and drop to the specified directory

3. Configure Environment variables

4. Set the system default JDK

5. Test the JDK


1. Download the JDK on the website

Address: http://www.oracle.com/technetwork/articles/javase/index-jsp-138363.html

Select the appropriate. gz package to download

The official website of the occasional convulsions will not download,

Can be downloaded from this address: http://download.csdn.net/download/aqtata/9022071, csdn 8u60 version, do not point

Note that to download the 32/64-bit version of the corresponding system, view the number of system bits command:

Uanme-a

If the wrong version is downloaded, it causes the Java/javac command to not run

will appear: bash:./java:cannot Execute binary file problem


2. Unzip and place in the specified directory (take jdk-7u60-linux-x64.gz as an example)

To create a directory:

sudo MKDIR/USR/LIB/JVM

Add compression to the directory:

sudo tar-zxvf jdk-7u60-linux-x64.gz-c/USR/LIB/JVM


3. Modify the Environment variables:

sudo vim ~/.BASHRC

Append the following to the end of the file:

#set Oracle JDK Environmentexport java_home=/usr/lib/jvm/jdk1.7.0_60 # # Here are the directories to be replaced with their own extracted JDK directory export Jre_home=${java_ HOME}/JRE Export Classpath=.:${java_home}/lib:${jre_home}/lib export path=${java_home}/bin: $PATH

Make environment variables effective immediately

SOURCE ~/.BASHRC


4. Set the system default JDK version

sudo update-alternatives--install/usr/bin/java java/usr/lib/jvm/jdk1.7.0_60/bin/java sudo update-alternatives-- Install/usr/bin/javac javac/usr/lib/jvm/jdk1.7.0_60/bin/javac sudo update-alternatives--install/usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_60/bin/jar sudo update-alternatives--install/usr/bin/javah javah/usr/lib/jvm/jdk1.7.0_60 /bin/javah sudo update-alternatives--install/usr/bin/javap javap/usr/lib/jvm/jdk1.7.0_60/bin/javap 300

Then execute:

sudo update-alternatives--config java

If you install the JDK for the first time, you will be prompted

There is only one alternative in link Group Java (Providing/usr/bin/java):

/usr/lib/jvm/jdk1.7.0_60/bin/java

No, choose the right JDK


5. Test the JDK

Java-version

Java Version "1.7.0_60"

Java (TM) SE Runtime Environment (build 1.7.0_60-b19)

Java HotSpot (TM) 64-bit Server VM (build 24.60-b09, Mixed mode)

JDK Installation succeeded


Debian/ubuntu under Installation Java8

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.