rJava install error “JAVA_HOME cannot be determined from the Registry”

后端 未结 9 793
独厮守ぢ
独厮守ぢ 2020-11-30 04:57

I am trying to load the rJava using the command:

 library(rJava)

But I get the following error:

 Error : .onLoad failed i         


        
相关标签:
9条回答
  • 2020-11-30 05:01

    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/

    0 讨论(0)
  • 2020-11-30 05:08

    I faced the same issue and was feeling very down as I couldnt get my analysis done. This worked for me :

    1. check your operating system. 64 bit or 32 bit. https://helpx.adobe.com/x-productkb/global/determine-whether-computer-running-32.html

    2. uninstall previous versions of Java.

    3. delete rJAVA library from Doc>R>win-library. If you have more than 1 versions of R, make sure you delete rJAVA package from all of them.

    4. install Java based on system requirement (64 bit or 32 bit).

    5. and finally restart R before and after installing rJava package.

    0 讨论(0)
  • 2020-11-30 05:09

    R for Windows installer installs by default both 32-bit and 64-bit files. Reinstalling R and unticking 32-bit part solved the problem for me.

    0 讨论(0)
  • 2020-11-30 05:11

    If R is 64-bit version make sure to install Java 64-bit version!

    If R is x86-bit version make sure to install Java x86-bit version!

    0 讨论(0)
  • 2020-11-30 05:22

    As mentioned in the r-statistics link cited above, you have to manually download the 64-bit version of Java. If not, then the 32-bit version will be installed.

    So, if you have a 64-bit operating system, then ensure that both R and Java are using the 64-bit installs. Otherwise, this problem will persist.

    0 讨论(0)
  • 2020-11-30 05:22

    This has been killing me and I have tried multiple methods above, it doesn't work. After, I mix all solution to try and below process works for me.

    1. Install Java for 64 bit
    2. Run below code in windows command
      setx PATH "C:\Program Files\Java\jre1.8.0_171\bin\server;%PATH%"
      (please change the address acorrding to your dvm.dll real address)
    3. Run below in R studio Sys.setenv(JAVA_HOME="")
      Then I finally can run
      library(rJava)
      library(xlsx)
    0 讨论(0)
提交回复
热议问题