为什么每次进入命令都要重新source /etc/profile 才能生效?
2018-01-29 10:16
2011 查看
#编辑JDK8 export JAVA_HOME="/usr/java/java8" #编辑maven export M2_HOME="/opt/idea-IU-162.1121.32/plugins/maven/lib/maven3" #编辑PATH export PATH="$JAVA_HOME/bin:$M2_HOME/bin:$PATH"
这是我的/etc/profile末尾的配置,JDK是没有问题的,不用source,echo $JAVA_HOME能出来,问题是如果要用mvn,每次就要source一遍才行,maven我用的是IDEA自带的。
回答 1、也可以放在~/.bashrc里面。或者在~/.bashrc里面加一句source /etc/profile
(采用此方法,已成功生效)
回答 2、你可以把这几条命令写在 /etc/bash里面 就会自动执行了
相关文章推荐
- 解决每次进入命令都要重新source /etc/profile 才能生效
- 每次都要source /etc/profile才能使hadoop、java命令生效解决方案(hadoop:未找到命令)
- linux 在/etc/profile配置完jdk每次都要source才能使用java命令(配置永久环境变量)
- source 命令找不到的情况(修改完/etc/profile文件之后,使其生效)
- 为什么我使用source /etc/profile这个命令之后,新的环境变量只能在一个终端里面有效? 为什么我使用source /etc/profile这个命令之后,新的环境变量只能在一个终端里
- linux 在/etc/profile配置完jdk每次都要source /etc/profile才能使用
- sudo source /etc/profile 提示找不到source命令
- linux 每次关机后重启都要手动source /etc/profile
- 改了/etc/profile后怎么才能立即生效而不重启机子
- 改了/etc/profile后怎么才能立即生效而不重启机子
- linux环境变量设置 以及 source命令 Linux 之 /etc/profile、~/.bash_profile 等几个文件的执行过程 Linux 设置环境变量
- Mac 每次都要执行source ~/.bash_profile 配置的环境变量才生效
- linux中使/etc/profile文件生效的命令
- [Deepin 15] sudo source /etc/profile 提示找不到 source 命令(切换到 root 用户:sudo su)
- linux 在/etc/profile配置完jdk每次都要source
- CentOS7 /etc/profile 添加环境变量重启后不生效 必须得执行source /etc/profile 解决方法
- source /etc/profile使设置生效
- ubuntu 用户修改.bashrc之后,每次登录需要运行source命令才生效
- linux 在~/.bash_profile配置完oracle每次都要source 才能使用的问题
- vs2013怎么配置opencv才能不用每次都重新配置一遍