简体   繁体   English

我想在Mac上安装Java JDK 8,但是.bash_profile无法检测到JAVA_HOME

[英]I want to install Java JDK 8 on mac, but .bash_profile won't detect JAVA_HOME

I'm trying to get Java JDK 8 on my mac. 我正在尝试在Mac上安装Java JDK 8。 I'm currently running the newest, update to date version 10.0.2 on macOS High Sierra 10.13.6. 我目前正在macOS High Sierra 10.13.6上运行最新的10.0.2版本。 I tried to nano .bash_profile and export the command 我试图nano .bash_profile并导出命令

export JAVA_HOME=$(usr/libexec/java_home -v 1.8)

and then source .bash_profile and it says: 然后来源.bash_profile并显示:

-bash: usr/libexec/java_home: No such file or directory

I tried googling and searching here, but nothing helped so far :/ 我尝试在这里进行谷歌搜索和搜索,但到目前为止没有任何帮助:/

Your path to java_home is relative and hence cannot be found by your bash script. 您到java_home路径是相对路径,因此bash脚本无法找到。 Try using: 尝试使用:

/usr/libexec/java_home

Note: the initial / makes it an absolute path. 注意:初始/使其成为绝对路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM