Search code examples
javarerror-handlingrjava

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


I am trying to load the rJava using the command:

 library(rJava)

But I get the following error:

 Error : .onLoad failed in loadNamespace() for 'rJava', details:
   call: fun(libname, pkgname)
   error: JAVA_HOME cannot be determined from the Registry
 Error: package or namespace load failed for ‘rJava’

I tried reinstalling both the Java and the R program with the latest versions but still get these errors.. May I know how I can resolve this? Thank you very much!


Solution

  • 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/