"Java" Linux installation configuration Oracle JDK version 1.7

Source: Internet
Author: User

1 environment

Ubuntu 12.04 32-bit system in VMware virtual machines

2 Specific installation steps

① Download the latest JDK package

Note that the JDK distinguishes between 32-bit and 64-bit versions and is compatible with Ubuntu.

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

② Create a directory, unzip the Tarball

mkdir USR/LIB/JVM

Move to the directory, and unzip

[Email protected]:/usr/lib$ sudo mv jdk-7u65-linux-x64.tar.gz./JVM
Extract
Tar zvxf jdk-7u65-linux-x64.tar.gz./JVM

③ Setting Environment variables

Edit the. Profile file

It's a good idea to back up your profile before you edit it

[Email protected]:/$ cp  ~/.profile ~/.profile_original

Open profile file sudo vim ~/.profile

Add the following command at the end of the. Profile file

Export java_home=/usr/lib/jvm/jdk1.7.0_65

Execute the following command at the terminal to make the modified configuration effective immediately:

SOURCE ~/.profile

Modify the system default JDK.

sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.7.0_65/bin/java 300

The results shown are as follows:

Modifying the Javac configuration

Effects such as

Then update the operation separately:

$ sudo update-alternatives--config java $ sudo update-alternatives--config javac

④ test whether the installation was successful

Then enter java-version and see the following information to change to the Sun's JDK:

⑤ issues that may be encountered

The following information is displayed when the validation is successful:

The reason: The JDK is 64-bit, and the operating system is 32-bit, does not match

The relationship of the JDK version

x86--32-bit x64--64 bit

When downloading, be sure to note whether it is 32-bit or 64-bit, to match your own system

⑥ Reference Articles

1 Blog Park, how to install JDK under Linux, take Ubuntu as an example

2 Blog Park, Ubuntu 12.04 Install and configure Java JDK

3 Ubuntu Forum, Ubuntu input Java command Prompt Unable to execute binary file

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.