dedian9 jdk超简单安装方法,安装步骤
1、下载jdk:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
选择解压版本,我这里使用:jdk-8u202-linux-x64.tar.gz
2、上传到服务器后解压
解压命令:
tar -xzvf jdk-8u202-linux-x64.tar.gz
3、配置
打开路径/etc/profile.d
找到bash_completion.sh文件,下载到本地,在文件结尾处添加如下配置
# 指定1.8 jdk
export JAVA_HOME=/usr/local/bluesky/software/jdk1.8.0_202/
export JRE_HOME=/usr/local/bluesky/software/jdk1.8.0_202/jre
export CLASSPATH=.:CLASSPATH:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
完整配置如下:
# Check for interactive bash and that we haven't already been sourced.
if [ -n "$BASH_VERSION" -a -n "$PS1" -a -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
# Source completion code.
. /usr/share/bash-completion/bash_completion
fi
fi
unset bash bmajor bminor
fi
# 指定1.8 jdk
export JAVA_HOME=/usr/local/bluesky/software/jdk1.8.0_202/
export JRE_HOME=/usr/local/bluesky/software/jdk1.8.0_202/jre
export CLASSPATH=.:CLASSPATH:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin