Linux配置JDK环境变量
简单记录不同shell环境下配置JDK的心酸历程
bash
#备份
sudo cp /etc/profile /etc/profile.bak
#
sudo nano /etc/profile
#将下面内容追加到profile中
export JAVA_HOME=/opt/jdk1.8.0_281
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
#保存并更新
source /etc/profile
fish
#创建
sudo nano ~/.config/fish/config.fish
#将下面内容追加到profile中
set -x JAVA_HOME /opt/jdk1.8.0_281
set -x CLASSPATH ".:{$JAVA_HOME}/lib/dt.jar:{$JAVA_HOME}/lib/tools.jar"
set -x PATH {$JAVA_HOME}/bin:$PATH
#保存并更新
source ~/.config/fish/config.fish
参考:
https://www.cnblogs.com/welhzh/p/5899875.html
http://fishshell.com/docs/current/cmds/fish_add_path.html?highlight=path