查看jdk在什么地方的命令 echo $JAVA_HOME
查看jdk的执行路径--使用which java whereis java
zip -qr jdk21.zip jdk21/
手动配置Java
环境变量
修改配置环境
vim /etc/profile
把下面的配置放到文件的最后一行
export JAVA_HOME=/usr/local/jdk1.8.0_202 # 这里设置解压的Java目录文件
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
让配置立即生效
source /etc/profile
## 获取java版本号 java -version ## 查看JDK的安装路径(安装后才有) which java
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).if [ "${PS1-}" ]; thenif [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then# The file bash.bashrc already sets the default PS1.# PS1='\h:\w\$ 'if [ -f /etc/bash.bashrc ]; then. /etc/bash.bashrcfielseif [ "`id -u`" -eq 0 ]; thenPS1='# 'elsePS1='$ 'fifi
fiif [ -d /etc/profile.d ]; thenfor i in /etc/profile.d/*.sh; doif [ -r $i ]; then. $ifidoneunset i
fi
export TMOUT=600
export HISTTIMEFORMAT="%F %T "
umask 022
ulimit -SHn 65535
export LANG="en_US.UTF-8"