查看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-}" ]; then
if [ "${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.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
export TMOUT=600
export HISTTIMEFORMAT="%F %T "
umask 022
ulimit -SHn 65535
export LANG="en_US.UTF-8"