In fact, jdk configuration on linux is very simple, but because there are a lot of linux kernel is, for example, I know of ubuntu and centOS. When configuring the difference between the two profiles.
However, the environment variable is the same.
Here to talk about the centOS and ubuntu jdk following configuration.
We must first download a good jdk, you can go to Baidu, and then download it at the official online face.
A: centOS following configuration jdk
1. jdk extract to / usr / local / below. Command is as follows:
tar -zxvf jdk-8u192.tar.gz /usr/local/
2. You can rename the name, so I think a good deal with some
First enter, usr / local / below, and then rename jdk:
cd /usr/local/
mv jdk-8u192 jdk
To then configure the environment:
vim /etc/profile
In the face of this final document is written:
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.tar:$JAVA_HOME/lib/tools.jar
Then let the acting profile:
source /etc/profile
This configuration is completed,
You can check whether the configuration with the following command:
java -version
Displays the version of jdk, then it was successful configuration.
Recommended jdk installation blog: https: //www.cnblogs.com/116970u/p/10400436.html
Two: ubuntu following configuration jdk
Jdk will also extract to / usr / local / directory, then rename jdk
That is, when the configuration file, select a different file, you can open the configuration file with the following command:
gedit ~/.bashrc
After opening the file, after the file's input:
export JAVA_HOME=/usr/local/jdk export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.tar:$JAVA_HOME/lib/tools.jar
Use the command to make the configuration file to take effect:
source ~/.bashrc
Use java -version view the configuration result, if the version number appears on the configuration was successful