1. Download jdk
Download Portal: jdk8
It's not my resource. If you think it's too expensive, you can find it elsewhere
. Originally, I wanted to upload a liunx and windows together, but it exceeded the size limit of the csdn upload file. I uploaded liunx separately and found that there are already resources.
2. Upload to liunx host
The recommended path is /usr/local/java
because several versions of jdk may be installed, so a new java directory is created
3. Unzip the tarball and rename it (rename is not necessary)
Unzip command tar -zxvf jdk-8u181-linux-x64.tar.gz
Rename command mv jdk1.8.0_181/ jdk8
4. Add environment variables
- vim /etc/profile Open profile file
- add environment variable
JAVA_HOME=/usr/local/java/jdk8 (注:替换成你的路径 其他不变)
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export JRE_HOME
export PATH
export CLASSPATH
3. Refresh environment variables (source /etc/profile)
5. Verify
Verify that the command java -version
outputs version information and the configuration is successful
write at the end
I am a pure novice, and the blog I wrote was also written because of the problems encountered in learning and use, after searching for materials and solving them. If there are some errors or infringements, please contact me.
QQ: 994961015
Email: [email protected]