I installed Java 8 SDK (with update 25 for JRE) from the Oracle Java site using the instructions on this page
http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html
and put the following line in my ~/.bash_profile
export JAVA_HOME="/usr/libexec/java_home -v 1.8"
but when I try to compile or run a Java program in Bash I get the following message
No Java runtime present, requesting install.
and this window
I ran /usr/libexec/java_home
to check:
$ /usr/libexec/java_home
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
But the JRE is in
/System/Library/Frameworks/JavaVM.framework/Versions/Current
and the JRE location in System Preferences is pointing to
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
I don't know what the problem is here, but usr/bin/javac
and /usr/bin/java
are not able to find the correct JVM location in /System/Library/Frameworks/JavaVM.framework/Versions/Current
.
The message “Unable to load Java Runtime Environment” means that the Mac computer cannot load JRE, either because it is out of date or (more usually) because it has not yet been downloaded and installed. It can also happen after the computer OS X has been updated, e.g. to 10.14 Mojave from 10.13 Maverick.
In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation.
I have encountered the same problem , i think you should install JDK but not JRE
You need to add some backticks:
export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"
The /usr/libexec/java_home
command outputs the right value for JAVA_HOME
on its standard output, you need to use backticks to capture that value so you can store it in the variable.
But the JRE is in /System/Library/Frameworks/JavaVM.framework/Versions/Current
No, it isn't. The Oracle JRE installs itself under /Library/Internet Plug-Ins
, the Oracle JDK installs under /Library/Java/JavaVirtualMachines
. The binaries under /usr/bin
and /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands
are stubs that delegate to whichever JDK your JAVA_HOME
variable points to.
Here's how I solved my problem on my mac
Check from RStudio if Java_HOME has been setup properly by running Sys.getenv("JAVA_HOME")
in the console. If it returns blank, you need to set it up properly
Check whether you have Java SDK installed
/usr/libexec/java_home -v
command. This will show you the library where you Java SDK is installed. If you don't have Java SDK installed yet, result from command above is blank, or the version is not up-to-date, download here and install the latest version.
Copy the library shown in step 2. On my mac, it shows:
/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
Back on your RStudio console, set the JAVA_HOME
Sys.setenv(JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home")
After doing the steps above, h2o.init()
ran without hitch.
Please carefully note @Ian Robert's point on JRE vs JDK distinction. We need JDK to make h2o run.
Here's how I solved my problem on my mac
Check from RStudio if Java_HOME has been setup properly by running Sys.getenv("JAVA_HOME")
in the console. If it returns blank, you need to set it up properly
Check whether you have Java SDK installed
/usr/libexec/java_home -v
command. This will show you the library where you Java SDK is installed. If you don't have Java SDK installed yet, result from command above is blank, or the version is not up-to-date, download here and install the latest version.
Copy the library shown in step 2. On my mac, it shows:
/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
Back on your RStudio console, set the JAVA_HOME
Sys.setenv(JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home")
After doing the steps above, h2o.init()
ran without hitch.
Please carefully note @Ian Robert's point on JRE vs JDK distinction. We need JDK to make h2o run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With