Install jdk on centos-download to normal operation

Source: Internet
Author: User

Install jdk on centos-download to normal operation

To install jdk, you must first download the jdk Installation File and use the wget command. If you enter the wget command and press enter to display wget: command not found, congratulations, your system has not installed wget. If you choose to install centos to minimize installation, wget will not be installed. Enter

Yum-y install wget

After installing wget, download jdk.

Wget is also a bitter time. Wget does not work. You have to select the agreement on the download page of oracle. However, you cannot select the protocol in Linux. You can find the protocol on the Internet after searching for multiple parties.

Wget -- no-cookies -- no-check-certificate -- header "Cookie: gpw_e24 = http % 3A % 2F % 2Fwww.oracle.com % 2F; using lelicense = accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz"

"Http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz" this is jdk, you can download it here.

Then configure the environment variable

I have a compressed package.

1. mkdir/usr/local/java # create a java directory and create a folder named java

2. tar xvf file name/usr/local/java # decompress the file

3. rm/usr/local/java/file name # Delete the compressed package

4. vi/etc/profile

Add the following content at the end of the file

Export JAVA_HOME =/usr/local/java/jdk1.8.0 _ 51

Export JRE_HOME = $ JAVA_HOME/jre

Export CLASSPATH =: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar: $ JRE_HOME/lib

Export PATH = $ PATH: $ JAVA_HOME/bin: $ JRE_HOME/bin

Save and exit: wq!

Note: The separator path is an English colon instead of a semicolon.

5. source/etc/profile

If no error is reported, the operation is successful.

Run java-version. if the version information is correctly displayed, jdk is successfully installed.

The following are some of the problems I encountered when installing jdk.

1. when downloading the jdk package, if the download is in seconds, you must note that the download may only be a webpage (html), because oracle needs to agree to the authentication during the download, therefore, append policlelicense = accept-securebackup-cookie. A specific example is provided at the beginning.

2. there are many versions online for environment variable configuration, but some of them are not suitable for you. If you have finished editing and executing source/etc/profile, what will happen. jar not such file or directory, lib is directory and so on, you should write the colon ":" into the Semicolon.

3. After the execution of source/etc/profile, not only java can not be used, but even the most basic vi, ls and so on won't be used, then your path configuration is wrong. Enter this sentence

Export PATH =/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Resetting the path will be okay. Then change the profile back.

4. If no error is reported after source/etc/profile is executed, a prompt is displayed when java-version is executed.

-Bash:/bin/java:/lib/id-linux.so.2: bad ELF interpreter, because 32-bit software is installed in the 64-bit System

After yum install glibc. i686 is installed, my java will run normally.

If you still cannot run normally and report

Error while loading shared libraries: libstdc ++. so.6: cannot open shared object file: No such file or directory

Try yum install libstdc ++. so.6

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.