Installation and configuration of Java environment under Linux

Source: Internet
Author: User

CentOS Ah ~centos ah ~centos AH ~ other not responsible Oh ~o (∩_∩) O haha ~

1. Install the JDK package jdk-7u80-linux-x64.rpm under Linux

Terminal input command: RPM-IVH jdk-7u80-linux-x64.rpm

2. Configure Environment variables

A. Using the Vim editor, open the/etc/profile file: Vim/etc/profile

b, add in line 54th of the profile file:

Java_home =/usr/java/jdk1.7.0_80

PATH = $PATH: $JAVA _home/bin

Export Java_home

C: Save exit: ESC--Input: Wq

D, execute the command: source/etc/profile, make the change take effect

E. Modify the link to the Java-related commands in the/usr/bin directory on the system:

Update-alternatives--install/usr/bin/java Java/usr/java/jdk1.7.0_80/bin/java 300

Update-alternatives--install/usr/bin/javac Javac/usr/java/jdk1.7.0_80/bin/javac 300

Update-alternatives--install/usr/bin/jar Jar/usr/java/jdk1.7.0_80/bin/jar 300

Update-alternatives--config Java

F, display all JDK versions, select the appropriate version to

3, verify, execute java-version command in terminal to see if the configuration is effective, display the corresponding information can

Installation and configuration of Java environment under Linux

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.