Build a JDK environment for Android (2) in Ubuntu

Source: Internet
Author: User

Recently, I have helped others install the hadoop system and encountered various problems. When installing JDK, the source is poor, and the Manual installation cannot identify the environment variables. The problems and methods of JDK installation are summarized as follows.

There are two ways to install JDK in Ubuntu: one is automatic installation. The steps are as follows:

  1. Enter sudo apt-Get install sun-java6-jdk. (The premise is that the system source has been updated to an available source)
  2. Configure the environment variables for sudo/etc/profile. Add the following content to the file: Export java_home = (Java installation location, the automatic installation directory is/usr/lib/JVM/Java-6-Sun)
    Export classpath = ".: $ java_home/lib: $ classpath" export Path = "$ java_home/: $ path"
  3. Java-verison verification and Installation

Method 1 requires a good source, but the Ubuntu source does not seem to have a few good updates, so most of them are not easy to use. At this time, only the second method is used, install JDK manually. The procedure for method 2 is as follows:

  1. Download the latest JDK installation package in http://java.sun.com, JDK-***-linux-i586.bin, put in directory with installation
  2. Enter the installation package directory under the terminal and enter sudo chmod U + x JDK-***-linux-i586.bin
  3. Then enter Sudo-S./JDK-***-linux-i586.bin to start the installation.
  4. Enter sudo/etc/profile to configure the environment variables. Step 2 in method 1.
  5. Enter Java-verison to verify Installation
  6. If the installation is successful, you must modify the default JDK directory in Ubuntu to the current installation directory. The procedure is as follows:
  7. Enter sudo Update-alternatives-install/usr/bin/Java (Java installation directory)/bin/Java 300 in the terminal
  8. Enter sudo Update-alternatives-install/usr/bin/javac (Java installation directory)/bin/javac 300 in the terminal.
  9. Run sudo Update-alternatives-config Java to confirm that the current installation directory is the JDK working directory.
  10. Enter Java-verison to verify Installation

So far, JDK installation is complete. Therefore, if the JDK environment variable configuration does not take effect during installation, you can configure it by referring to steps 7-9 in method 2. If this method does not work, you can only use the ultimate method: Enter the following command in the command line

Path = $ PATH :( Java installation directory)

Export path

This method is only temporary modification of environment variables, which is difficult after the machine is restarted.

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.