Install and configure JDK in CentOS 7 and jdk in centos 7

Source: Internet
Author: User

Install and configure JDK in CentOS 7 and jdk in centos 7

1. Set up an ftp server

We have installed the vsftpd server on CentOS. For details about how to install and configure the vsftpd server, refer to enable FTP and configure users in CentOS, install the LeapFTP client in Windows, and upload resources to the vsftpd server through LeapFTP, it is stored in the/var/ftp/pub path of CentOS by default.

2. Enable the ssh service

The ssh service of CentOS is disabled by default.Service sshd startCommand to enable the CentOS ssh service, install the putty client on Windows, so that you can remotely control the CentOS System on windows through putty.

3. Install jdk

Enter the commandCd/var/ftp/pubEnter the pub directory and enter the commandLsShow all files in pub. By default, the resources do not have the execution permission, so we need to enterChmod + x jdk-8u45-linux-x64.rpmGrant the execution permission to the resource and enter the resource again.LsCommand. If the target resource is green, it indicates that you have the execution permission.

RunRpm-ivhJdk-8u45-linux-x64.rpmCommand to install jdk. The default installation path is/usr/java/java1.8.0 _ 45. To facilitate later configuration, You can rename the file and enter the commandMv/Usr/java/java1.8.0 _ 45/Usr/java/java1.8Rename java1.8.0 _ 45 to java1.8.

4. Configure jdk Environment Variables

Enter the commandVi/etc/profileVi is the command mode by default. Enter the commandIThen enter the editing mode. Add the following content at the end of the profile:

JAVA_HOME=/usr/java/jdk1.8PATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOMEexport PATHexport CLASSPATH

After editing, Press ESC and enter : XSave and exit.

5. Test jdk

Enter the javac-version command. If the java version is displayed, the configuration is successful.

Related Article

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.