Linux配置JDK环境变量

时间:2021-04-13 00:47:39   收藏:0   阅读:62

Linux配置JDK环境变量

简单记录不同shell环境下配置JDK的心酸历程

  1. bash
  2. fish

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

原文:https://www.cnblogs.com/xfcy2233/p/14651044.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!