Home  >  Article  >  Operation and Maintenance  >  How to install jdk in linu

How to install jdk in linu

小云云
小云云Original
2018-03-21 09:26:571989browse

JDK is a Java language software development toolkit, mainly used for java applications on mobile devices and embedded devices. JDK is the core of the entire Java development. It includes the JAVA runtime environment (JVM+Java system class library) and JAVA tools. This article mainly shares with you how to install jdk in linu. I hope it can help you.

1: Download jdk

Address: Click to open the link



##2: Uninstall openjdk

Some versions of centos have OpenJDK installed by default, so you need to check it first

Command: rpm -qa | grep java



displays as follows: (If it exists, uninstall it, if not, don’t use it.) Note that the version may be slightly different, whichever is actual.
tzdata-java-2013g-1.el6.noarch
java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
java-1.6.0-openjdk-1.6.0.0 -1.66.1.13.0.el6.x86_64


Uninstall openjdk:

(where the parameter "tzdata-java-2013j-1.el6.noarch" is the one shown in the above view Just paste the result in. If what you see is different, please copy the result you found)



rpm -e --nodeps tzdata-java-2013g-1.el6.noarch
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13. 0.el6.x86_64

Three: Create directory, upload, decompress



[html] view plain copy

    ##[root@localhost java]# cd /usr/local
  1. [root@localhost local]# mkdir java #Create java directory
  2. [root@localhost local]# cd java
  3. Upload the downloaded jdk-8u161-linux-x64.tar.gz to the java directory and decompress it



[html]

view plain copy

##[root@localhost java]# tar -zxvf jdk -8u161-linux-x64.tar.gz #Decompression
  1. ##[root@localhost java]# mv jdk1.8.0_161 jdk #Rename

Four: Configure environment variables




##[html]

view plain
copy

[root@localhost java]# vi /etc/profile

  1. Add the following content:


##[plain]

view plain

copy

#set java environment

    JAVA_HOME=/usr/local/java/jdk #java path According to your own reality Path to configure
  1. JRE_HOME=/usr/local/java/jdk/jre #jre path Configure according to your own real path
  2. CLASS_PATH =.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
  3. PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/ bin
  4. ##export JAVA_HOME JRE_HOME CLASS_PATH PATH
  5. Related recommendations:
  6. Linux uninstall jdk, rpm command, rm Command parameter method

Linux installation JDK, Tomcat and MySQL graphic tutorial

Linux installation JDK implementation steps detailed explanation

The above is the detailed content of How to install jdk in linu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn