Ubuntu installation orcal JDK

Source: Internet
Author: User

Ubuntu 14 Installation Jdk7:

Official website Download: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Select Accept license and choose the JDK download that suits your model.

1. unzip the downloaded JDK file:

[email protected]:~$ ls

Workspace public template video picture document download music Desktop
[Email protected]:~$ cd Download

$ sudo mkdir/usr/lib/jvm$ sudo tar-zxvf jdk-7u55-linux-i586.tar.gz-c/USR/LIB/JVM

2. Configure environment variables below

Command editing
$: Vim ~/.BASHRC

3. Add a command at the bottom

Export java_home=/usr/lib/jvm/Jdk1.7. 0_55

Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH

4. using Commands

SOURCE ~/.BASHRC

5. Configure the default JDK version:

sudo update-alternatives--install/usr/bin/java java/usr/lib/jvm/jdk1.7. 0_55/bin/java -

sudo update-alternatives--install/usr/bin/javac javac/usr/lib/jvm/jdk1. 7. 0_55/bin/javac
sudo update-alternatives--install/usr/bin/jar jar/usr/lib/jvm/jdk1. 7. 0_55/bin/jar
sudo update-alternatives--install/usr/bin/javah javah/usr/lib/jvm/jdk1. 7. 0_55/bin/javah
sudo update-alternatives--install/usr/bin/javap javap/usr/lib/jvm/jdk1. 7. 0_55/BIN/JAVAP

6. perform the update:

sudo update-alternatives--config java

will appear as follows:

[Email protected]:~$ sudo update-alternatives--config java
Yes3A candidate can be used to replace Java (provides/usr/bin/java).


Select Path Priority state
------------------------------------------------------------
*0/usr/lib/jvm/java-6-openjdk/jre/bin/java1061Automatic mode
1/usr/lib/jvm/java-6-openjdk/jre/bin/java1061Manual mode
2/usr/lib/jvm/java-6-sun/jre/bin/java theManual mode
3/usr/lib/jvm/java-7-sun/bin/java -Manual mode


To maintain the current value [*], press ENTER, or type the number you selected:3update-alternatives: Using/usr/lib/jvm/java-7-sun/bin/java to provide/usr/bin/java (Java) in manual mode.

7. Test:

Java-version (Displays the following information indicating that the configuration was successful)
Java version"1.7.0"
Java (TM) SE Runtime Environment (build1.7.0-b147)Java HotSpot (TM) Client VM (Build21.0-b17, mixed mode)

8. If the following questions occur:

BASH:/usr/lib/jvm/java-7-sun/bin/java: No file or directory

This is because the 32-bit runtime ia32-libs is missing and the 64-bit system is equipped with 32-bit JDK, which can be installed to resolve

To perform a code installation:

sudo apt-GetInstall Ia32-libs

If you continue to appear:

Reading Package List ... Complete
Analyzing Dependency tree for Package
Reading status information ... Complete
There is no package ia32-libs available now, but it is referenced by other packages.
This may mean that the missing package may have been discarded,
Or can only be found in other publishing sources
However, the following packages replace it:

lib32z1 lib32ncurses5 lib32bz2- 1.0
E: Package ia32-libs not available for installation candidate

In fact, the problem is very good to solve the top not tell you that the bag has been replaced? The 13.10 version is too high and has been eliminated. So:sudo Apt-getinstallLib32z1

Just fine!

Last re-execution:

$: Java-version

The JDK version information appears to indicate that the installation was successful

Ubuntu installation orcal JDK

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.