Get the App
SLTechnology News&Howtos  ›  Database  › 

CentOS system installs JDK

Shulou Source: shulou.com Published: 2022-06-01 10:46:52 10月04日 Update

Download jdk from oracle needless to say

Tar zxvf * .tar.gz (* .tar.gz is the name of the downloaded file, decompress.)

Mv * jdk (* is the folder you unzipped, change your name, I change it to jdk, change whatever I like, I'll change this easy to remember)

Mv jdk / usr/local/ (then put the renamed folder in / usr/local/)

Vi / etc/profile (edit the configuration, environment variables)

Add at the end:

JAVA_HOME=/usr/local/jdk

Export JRE_HOME=/usr/local/jdk/jre

Export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

Export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

Then modify the default JDK:

Update-alternatives-install / usr/bin/java java/ usr/java/bin/java 300

Update-alternatives-install / usr/bin/javac javac / usr/java/bin/javac 300

Update-alternatives-config java

Update-alternatives-config javac

Source / etc/profile

Java-version

Javac-version

Tags: Files folders No variables File names Environment Oracle Oracle easy to remember configuration system Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB OPPO Reno Microsoft macOS