Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Ubuntu 中 root 帳號無法使用 javac 的解法

在 Ubuntu 上,我們通常把 JDK 的環境變量寫進 /etc/profile:

Ubuntu 中 root 帳號無法使用 javac 的解法

此時一般使用者執行 java -version 或 javac 都能成功,偏偏 root 就是不行。原因在於 root 的環境並不會完整繼承 /etc/profile 的設定。

解法是同時在 /etc/environment 中補上對應配置:

Ubuntu 中 root 帳號無法使用 javac 的解法

如果做完這一步仍然無效,就編輯 /root/.bashrc,把環境變量直接寫進去即可。

Copyright © Linux教程網 All Rights Reserved