linux java deployment production environment

Download the file
First go to the web page:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Click Accept License Agreement and select jdk-8u161-linux-x64.tar.gz to download.

Configure the environment
and then extract it to your own defined software directory, such as my /home/soft directory:

tar -xzvf jdk-8u161-linux-x64.tar.gz

Then vim ~/.bashrc, modify the configuration environment variables, here focus on CLASSPATH, if JAVA_HOME and PATH have been set, there is no need to modify them.

export JAVA_HOME=/home/soft/jdk1.8.0_161
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin

Next source ~/.bashrc to make it effective.

Finally, enter java -version in the terminal, if it prints out:

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

It proves that the Java environment configuration is successful!

Guess you like

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