Install JDK in Ubuntu

Source: Internet
Author: User

This problem occurs when we compile the android source code.

Build/CORE/config. mk: 271:

* ** Error: cocould not find JDK tools. jar, please install jdk6, which you can download from java.sun.com. Stop.

In the final analysis, JDK 6 is not installed, or is not installed. Therefore, we need to install JDK 6 again. The Android Developers website is not installed successfully. Therefore, we need to install JDK 6 manually, manual installation involves the following steps:

First:Download and manually install JDK 6 ,:

Http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html

Now, go to the download directory. After that, decompress the package.

Ii. decompress:

To the downlaod Directory: CD download

Modify permissionsSudo chmod U + x JDK *****. Bin

Start decompression:./JDK *****. Bin

After decompression, a folder jdk1.6.0-version is generated.

Iii. Mobile JDK

First, check whether the/usr/bin/JVM directory exists.

Sudo mkdir/usr/bin/JVM

After the jdk1.6.0 is created, move it to this directory.

Sudo MV jdk1.6.0/usr/bin/JVM/

Iv. Configure Environment Variables

Returns the Home Directory, CD

Open the file configuration environment: sudo gedit/etc/profile

Add the following at the end of the file:

Export java_home =/usr/lib/JVM/jdk1.6.0
Export jre_home =$ {java_home}/JRE
Export classpath =. :$ {java_home}/lib :$ {jre_home}/lib
Export path =$ {java_home}/bin: $ path

Save and exit

Input: Source ~ /. Bashrc

5. Configure the default JDK version:

Ubuntu may have a default JDK, such as openjdk. To set the JDK we installed as the default JDK version, perform the following work.
RunCode:
Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/jdk1.6.0/bin/Java 300
Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JVM/jdk1.6.0/bin/javac 300
Sudo Update-alternatives -- install/usr/bin/Jar/usr/lib/JVM/jdk1.6.0/bin/jar 300
Sudo Update-alternatives -- install/usr/bin/javah/usr/lib/JVM/jdk1.6.0/bin/javah 300
Sudo Update-alternatives -- install/usr/bin/javap/usr/lib/JVM/jdk1.6.0/bin/javap 300

Run the Code:

Sudo Update-alternatives -- config Java

Select a version.

Vi. Test

Enter Java-version

If the Java version is better than yours, it will be successful!

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.