Install and configure Java JDK in Ubuntu 12.04

Source: Internet
Author: User
Tags gz file

Install and configure Java JDK in Ubuntu 12.04. First, download the jdkzip package under linux. I downloaded the jdk-7u4-linux-i586.tar.gz file. After the file is downloaded, decompress it directly.

Step 1:
# 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/jdk1.7.0 _ 21

Step 2:
# Configure Environment Variables
Sudo gedit ~ /. Profile
Add:
Export JAVA_HOME =/usr/lib/jvm/jdk1.7.0 _ 21

Save and close, and use source to update
$ Source ~ /. Profile

Use the env command to view the JAVA_HOME Value
$ Env
If JAVA_HOME =/usr/lib/jvm/jdk1.7.0 _ 21, the configuration is successful.

Step 3:
# Modify the system's default jdk
$ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.7.0 _ 21/bin/java 300

Just enter the number before sun jdk.
$ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jvm/jdk1.7.0 _ 21/bin/javac 300

$ Sudo update-alternatives -- config java
$ Sudo update-alternatives -- config javac

Step 4:
Then enter java-version. The following information is displayed, indicating that the jdk is changed to sun:
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)

Possible problems:
1. The error message "libjli. so cannot be started" is displayed ......, This problem occurs because the downloaded Java JDK package is incomplete or your decompression method is incorrect. Directly decompress the package to the current path and copy it to the desired directory, the JDK installation directory can be selected at will, for example, you can put it under the HOME Directory,
The libjli. so file is in :~ /Jdk1.7.0 _ 07/jre/lib/i386/jli/libjli. so

2. The configuration may fail. You need to uninstall the previously installed OpenJDK. You can run the command line to remove it.

3. for JDK of different versions, modify the version above.

Install JDK 7 In Ubuntu (with Clojure download)

Install JDK 12.04 in Ubuntu

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.