Virtualbox Linux installation jdk1.8 and configuration (with Oracle account)

Time:2022-11-25

foreword

In Linux, you can simply install jdk through yum, but it seems that there is no environment variable for this installation.
There will be troubles in some places where environment variables need to be filled.

The goal of this article

Install jdk1.8 on Linux and configure environment variables

1. Official website download

Link:Official website link
Select the appropriate version and select the file with the tar.gz suffix
Virtualbox Linux installation jdk1.8 and configuration (with Oracle account)
Oracle download requires login, enjoy an account to obtain the platform:Link

2. Create a folder for storage

mkdir /usr/java

3. Upload the file to the newly created folder

I use finalshell, just drag and drop to upload
Virtualbox Linux installation jdk1.8 and configuration (with Oracle account)

4. Unzip

tar -zxvf jdk-8u351-linux-i586.tar.gz

5. Add environment variables

vi /etc/pofile

Add the following at the end of the file

#java
export JAVA_HOME=/usr/java/jdk1.8.0_351
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}

Among them, JAVA_HOME should correspond to your installation location

6. Reload configuration file

source /etc/profile

7. Verify

java -version

Virtualbox Linux installation jdk1.8 and configuration (with Oracle account)

Recommended Today

Rust Tutorial

structure For the definition and use of rust structures, only a few points that need special attention are explained, and the basic usage is not described. Shorthand syntax when the variable has the same name as the field nameIt can directly correspond to the variable name of each field, without using the method of field […]