0

When I want to install the xlsx package, I get this error :

Loading required package: rJava

Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry In addition: Warning message: package ‘rJava’ was built under R version 3.3.3 Error: package ‘rJava’ could not be loaded

So I tried reinstalling rJava, but I get this :

Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry In addition: Warning message: package ‘rJava’ was built under R version 3.3.3 Error: package or namespace load failed for ‘rJava’

Do you guys have any simple solution to this ? I am not very familiar with R, and I just need it to bootstrap some data.

  • 1
    not really an answer, but I overcame this by using `openxslx`(https://www.google.ch/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwjs_-zotPXWAhVGtBQKHZWOAxsQFggzMAE&url=https%3A%2F%2Fcran.r-project.org%2Fpackage%3Dopenxlsx&usg=AOvVaw0HGh8kKb3jtaGRY22pOpdT) instead. It offers the same functionalities without having Java as a dependency. – hartmut Oct 16 '17 at 15:04
  • 1
    Else, could you tell us whether you use r 32 or 64 bits? And the same for java? I think the problem could be related to using e.g., R 64 and Java 32. – hartmut Oct 16 '17 at 15:05
  • You should accept the answer that was published! It works very well! – Beginner Nov 11 '21 at 17:05

1 Answers1

1

I had the same error recently (R Error: JAVA_HOME cannot be determined from the Registry). I found the solution here. In brief, Joachim Schork identified the problem as not the xlsx package but rather the rjava package. He explained that the problem usually is, as hartmut said, running a 64 bit version of R and a 32 bit version of Java. To resolve the problem according to his recommendation, you need to download and install the 64 bit version of Java. In my case, the solution included installing Java on my machine as it was never installed previously.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • Excellent answer! I had the same problem with the R package staplr. Your solution works for that problem. – Beginner Nov 11 '21 at 17:04