Install jdk1.8 on CentOS7

Source: Internet
Author: User

Install jdk1.8 on CentOS7

1. Create a Java folder under the/var/local directory.

mkdir /var/local/java

Copy jdk to/var/local/java to enter the java folder and decompress the compressed package.

tar xvf jdk-8u112-linux-x64.gz

2. Set the environment variable. The global setting method is used here to modify the etc/profile. It is the environment variable shared by all users. Locate/etc/profile, edit it, and add it at the end.

export JAVA_HOME=/var/local/java/jdk1.8.0_112export JRE_HOME=/var/local/java/jdk1.8.0_112/jreexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$PATH

Remember, do not add spaces on both sides of the equal sign during the above process. Otherwise, "invalid identifiers" will appear, because unnecessary spaces cannot be identified during source/etc/profile, it is understood as part of the path. Then save

Run the following command to make the profile take effect

source /etc/profile

3. Check whether the operation is successful on the terminal

java -version
javac

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.