rJava install error "JAVA_HOME cannot be determined from the Registry" rJava install error "JAVA_HOME cannot be determined from the Registry" r r

rJava install error "JAVA_HOME cannot be determined from the Registry"


This error is often resolved by installing a Java version (i.e. 64-bit Java or 32-bit Java) that fits to the type of R version that you are using (i.e. 64-bit R or 32-bit R). This problem can easily effect Windows 7 users, since they might have installed a version of Java that is different than the version of R they are using.

http://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/


Install 64 bit Java from https://java.com/en/download/manual.jsp.
Then in windows cmd run
setx PATH "C:\Program Files\Java\jre1.8.0_211\bin\server;%PATH%"
(make sure your path is correct).

Then in RStudio run
Sys.setenv(JAVA_HOME="")

Now, you should be able to run rJava!!


I got the same error resolved by installing same version of R and Java i.e. 64 bits and manually updating the path i.e. ,

Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre1.8.0_121') # for 64-bit version