Linux builds a test environment (1)

Install JDK and configure JDK environment

1. Prepare in advance.

  • Install the virtual machine
  • Install the Linux environment on the virtual machine

2. Install JDK

  1. Check whether the version of the Linux system is 32-bit or 64-bit Enter
    in the Linux command line: uname -a (here is 64-bit)
    write picture description here

  2. Go to the JDK official website to download the 64-bit JDK (the download steps are omitted), and visit the link: http://www.oracle.com/technetwork/java/javase/downloads/index.html

  3. After the download is complete, use the xftp tool to upload the jdk on the machine to the Linux server. The directory is the /opt directory (the /opt directory is equivalent to the program file directory of the Windows system). After the upload is complete, view the /opt directory as shown below
    write picture description here

Delete the JDK that comes with the system, and execute the command rpm -qa | grep java to view the corresponding packages of OpenJDK
write picture description here
Delete these four packages
write picture description here

  1. Unzip the JDK compressed package and execute the command tar -xzvf jdk-10_linux-x64_bin.tar.gz, the JDK directory will be generated in the current path
    write picture description here
  2. Configure the relevant environment variables, switch the directory to the /etc/profile file and
    use the vi editor to configure the following content
    A, JAVA_HOME=/opt/jdk-10
    B, PATH= JA VAHO ME/bin: PATH
    write picture description here

    C、需要执行/etc/profil相关的配置才能生效,执行命令如下:source /etc/profile
    D、查看系统是否装上jdk,执行如下命令:java -version,返回如下信息,证明安装成功
    

    write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326117329&siteId=291194637