我使用本页面上的说明从Oracle Java站点安装了Java 8 SDK(JRE更新为25)
http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html
Run Code Online (Sandbox Code Playgroud)
并把以下一行放在我的 ~/.bash_profile
export JAVA_HOME="/usr/libexec/java_home -v 1.8"
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在Bash中编译或运行Java程序时,我收到以下消息
No Java runtime present, requesting install.
Run Code Online (Sandbox Code Playgroud)
和这个窗口
![enter image description here][1]
Run Code Online (Sandbox Code Playgroud)
我跑去/usr/libexec/java_home
检查:
$ /usr/libexec/java_home
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Run Code Online (Sandbox Code Playgroud)
但是JRE在
/System/Library/Frameworks/JavaVM.framework/Versions/Current
Run Code Online (Sandbox Code Playgroud)
并且系统偏好设置中的JRE位置指向
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
Run Code Online (Sandbox Code Playgroud)
我做的问题是在这里没有什么,但usr/bin/javac
并/usr/bin/java
不能找到正确的JVM的位置/System/Library/Frameworks/JavaVM.framework/Versions/Current
.