Installing and configuring Java JDK in Ubuntu 12.04

Source: Internet
Author: User

Ext.: http://www.cnblogs.com/bluestorm/archive/2012/05/10/2493592.html

Go first.Oracle DownloadsLinux under the JDK compression package, I downloaded the jdk-7u4-linux-i586.tar.gz file, the next good after the direct decompression

STEP1:
# Copy the extracted jdk1.7.0_21 folder to the/USR/LIB/JVM directory with the highest permissions
sudo cp-r ~/jdk1.7.0_21//usr/lib/jvm/

STEP2:
# Configure Environment variables
sudo gedit/etc/profile
At the end add:
Export java_home=/usr/lib/jvm/jdk1.7.0_21

Then save the shutdown, using the source update under
$ source/etc/profile

Use the ENV command to see the value of Java_home
$ env
If java_home=/usr/lib/jvm/jdk1.7.0_21, the configuration is successful.

STEP3:
# Modify the system's default JDK.
$ sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.7.0_21/bin/java 300

Just enter the numbers in front of the sun JDK.
$ sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_21/bin/javac 300

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

STEP4:
Then enter java-version and see the following information to change to the Sun's JDK:
Java Version "1.7.0_04"
Java (TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot (TM) Server VM (build 23.0-b21, Mixed mode)

Problems that may exist:
1. Prompt missing libjli.so cannot start ..., the problem is that you download the JAVAJDK compression package is incomplete, or your decompression method is not the result, directly extracted to the current path, and then copied to the directory you need, the JDK installation directory can be arbitrarily selected, For example, you can put it in the home directory,
libjli.so file in: ~/jdk1.7.0_07/jre/lib/i386/jli/libjli.so

2. May not be configured successfully, need to uninstall the previously installed OPENJDK, can be removed from the command line

3. Different versions of the JDK, version number as modified can be

Installing and configuring Java JDK in Ubuntu 12.04

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.