Detailed steps for downloading, installing, and configuring jdk1.8 on the Linux system using the command line (for example, CentOS) __centos

Source: Internet
Author: User

1. Log in with the root user system, if the system already has other versions of the JDK, you can uninstall the relevant software package, command:

RPM-E--nodeps Jdkname

Where jdkname can not include character segments for version information, you can view them by using the following command:

Rpm-qa | grep JDK


2. Download the jdk1.8. rpm file from the Oracle website, address if http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.rpm? AUTHPARAM=1421409865_906DD11E2CABEF6E49C0A4E4B1A92B3A, the command is:

cd/user/local--first enter the directory where the package is saved

wget http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.rpm? authparam=1421409865_906dd11e2cabef6e49c0a4e4b1a92b3a

After downloading, you can use the LS command to see the download to the file name jdk-8u25-linux-x64.rpm? AUTHPARAM=1421409865_906DD11E2CABEF6E49C0A4E4B1A92B3A, can be renamed before installation:

MV jdk-8u25-linux-x64.rpm? AUTHPARAM=1421409865_906DD11E2CABEF6E49C0A4E4B1A92B3A jdk-8u25-linux-x64.rpm


3. Install JDK:

RPM-IVH jdk-8u25-linux-x64.rpm

The default path for installation is/usr/java

You can then use the java,javac,java-version command to view the relevant information


4. Configure Environment variables

To edit a configuration file with Vim:

Vim/etc/profile

Press I into insert mode, append at end

Java_home=/usr/java/jdk1.8.0_25
Jre_home=/usr/java/jdk1.8.0_25/jre
Path= $PATH: $JAVA _home/bin: $JRE _home/bin
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
Export Java_home jre_home PATH CLASSPATH

Press ESC to exit Insert mode, and then: Wq Save the changes and exit, and then use the following command to make the configuration effective:

Source/etc/profile


5. After this installation is configured, you can view path and java_home:

Echo $PATH

Echo $JAVA _home

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.