R: rJava package install failing

后端 未结 17 1184
Happy的楠姐
Happy的楠姐 2020-11-22 16:28

When installing rJava using the install.packages(\"rJava\") command I get the following error:

checking Java support in R... present:
interprete         


        
17条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 16:45

    I was facing the same problem while using Windows 10. I have solved the problem using the following procedure

    1. Download Java from https://java.com/en/download/windows-64bit.jsp for 64-bit windows\Install it
    2. Download Java development kit from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html for 64-bit windows\Install it
    3. Then right click on “This PC” icon in desktop\Properties\Advanced system settings\Advanced\Environment Variables\Under System variables select Path\Click Edit\Click on New\Copy and paste paths “C:\Program Files\Java\jdk1.8.0_201\bin” and “C:\Program Files\Java\jre1.8.0_201\bin” (without quote) \OK\OK\OK

    Note: jdk1.8.0_201 and jre1.8.0_201 will be changed depending on the version of Java development kit and Java

    1. In Environment Variables window go to User variables for User\Click on New\Put Variable name as “JAVA_HOME” and Variable value as “C:\Program Files\Java\jdk1.8.0_201\bin”\Press OK

    To check the installation, open CMD\Type javac\Press Enter and Type java\press enter It will show

    In RStudio run

    Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jdk1.8.0_201")
    

    Note: jdk1.8.0_201 will be changed depending on the version of Java development kit

    Now you can install and load rJava package without any problem.

提交回复
热议问题