-bash: java-version: command not found
操作步驟:
進入服務器,輸入:java -version
返回:-bash: java-version: command not found
輸入:source /etc/profile
再次輸入:java -version
顯示JDK版本
所以,重新進入服務器,需要source /etc/profile才能找到JDK。
解決方法:在~/.bashrc 里面加一句source /etc/profile,可解決。
1.用vim打開~/.bashrc 進行編輯
vim ~/.bashrc
2.在文件最后添加:
source /etc/profile
3.保存退出
Esc鍵 :wq