Linux installation JDK

Source: Internet
Author: User

Windows installation JDK is simple, but often novice ask Linux how to install the JDK, the following installation steps introduced, this article in the case of CentOS Linux, The installed JDK version is 1.7.0.25 (jdk-7u25-linux-x64.tar.gz), the master please drift over.

Tools/Materials
    • Redhat/centos Series Linux Distribution system
    • jdk-7u25-linux-x64.tar.gz, Shell Client
Method/Step
  1. 1

    Download the JDK package to the specified directory

  2. Check JDK version, uninstall OPENJDK version (the difference between JDK and OPENJDK does not repeat here)

    Check the java–version, javac–version command to see the version first (i)

  3. Checked for JDK version 1.7.0.45; re-enter Rpm-qa|grep Java view (ii)

  4. Note: There may be a difference in the version of OPENJDK installed for different CentOS versions; If no list is displayed, you can see the 4th step directly

    Uninstall the above three files (requires root permission, login root permission uninstall) (iii)

    RPM-E--nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64

    RPM-E--nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64

    RPM-E--nodeps Tzdata-java-2013g-1.el6.noarch

  5. View JDK information again (iv)

  6. You are now ready to install the Oracle version of the JDK.

    Unzip the JDK, unzip the command: Tar-xvzf jdk-7u25-linux-x64.tar.gz

    JDK Location:/home/codebrother/jdk/jdk-7u25-linux-x64.tar.gz, unzip the current path, after decompression, the JDK folder will appear, enter the JDK directory, and see the contents of the directory (v)

  7. Configuring the JDK environment variables

    In a Linux system, you need to add the bin directory of the JDK in path, create a classpath, and add the JDK's lib directory.

    JDK's home directory:/home/codebrother/jdk/jdk1.7.0_25

    The bin directory of the JDK:/home/codebrother/jdk/jdk1.7.0_25/bin

    Lib directory for JDK:/home/codebrother/jdk/jdk1.7.0_25/lib

    Edit ~/.BASHRC file, vi ~/.BASHRC

    Add the following variable (vi)

    Export java_home=/home/codebrother/jdk/jdk1.7.0_25

    Export java_bin= $JAVA _home/bin

    Export java_lib= $JAVA _home/lib

    Export classpath=.: $JAVA _lib/tools.jar: $JAVA _lib/dt.jar

    Export path= $JAVA _bin: $PATH

  8. Press the ESC key, and then: Wq Save to exit

  9. Make the JDK environment variable effective, source ~/.BASHRC (vii)

  10. View JDK version

    Input java-version, javac–version (eight)

  11. If the above information appears, it proves that the JDK installation was successful! Java development is now available.

Linux installation JDK

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.