centerOs6.5 Installing Java

Source: Internet
Author: User

1. First check that the JDK is not the default

Or

# rpm-qa|grep Java

Discover that there is no Java

There is no, if it is installed with a virtual machine, there may be openjdk, you need to uninstall and install it first.

2. Download Java to the server

I first downloaded from the Java official website and then connected to the server via SECURECRT to copy the files to the server.

Copy to/usr/local/java inside.

3. Unzip

Then execute # TAR-ZXVF jdk-8u171-linux-x64.tar.gz

You can see one more folder underneath the Java folder jdk1.8.0_171

4. Configure Environment variables

# Vi/etc/profile

java_home=/usr/local/java/jdk1.8.0_171
Jre_home=/usr/local/java/jdk1.8.0_171/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

Execute # source/etc/profile make code effective

You can view the environment variables by using the # echo $PATH

Or the # echo $JAVA _home

Java-version javac-version

So Java is installed.

centerOs6.5 Installing Java

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.