"etc/profile" E212: Can't open file for writing

时间:2022-02-20 11:21:00

今天安装Java环境,出现如下错误:

"etc/profile" E212: Can't open file for writing

这是安装到本地JDK路径不正确导致。怎么办呢?那就设置路径呀。

输入这条指令   sudo vim etc/profile   报错啊,权限不够,那我们找他领导解决呀:

sudo vi hosts   再次编辑即可,可能会用到的指令:

# System-wide .profile for sh(1)

 

if [ -x /usr/libexex/path_helper ]; then eval '/usr/libexec/path_helper -s'

 

fi

 

if [ "${BASH-no}" != "no" ]; then 

        [ -r /etc/bashrc ] && . /etc/bashrc

fi

 

#配置 JAVA_HOME,此处路径根据自己的版本填写

JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/"

CLASS_PATH="$JAVA_HOME/lib"

PATH=".;$PATH:$JAVA_HOME/bin"