Unable to locate an executable at “/usr/bin/java/bin/java” (-1)

后端 未结 8 1647
天命终不由人
天命终不由人 2020-12-13 11:53

I am having a pathetic issue with Java in my mac osx 10.7.3 . Previously I installed it and it was working fine. After some changes in the .bash_profile and .profile file in

相关标签:
8条回答
  • 2020-12-13 12:49

    JAVA_HOME is not the name of the java executable. But of the directory, java was installed in. The executable should be $JAVA_HOME/bin/java.

    The which command is not helpful for you there. It will not give you the java home, but most likely this is just a wrapper or symlink to java installed in a very different directory.

    0 讨论(0)
  • 2020-12-13 12:54

    In MacOS Catalina, run

    sudo nano ~/.bash_profile
    

    In bash_profile, add:

    export JAVA_HOME=$(/usr/libexec/java_home)
    source ~/.bash_profile
    

    Verify by running java --version

    0 讨论(0)
提交回复
热议问题