Cannot load rJava because cannot load a shared library

后端 未结 6 533
陌清茗
陌清茗 2020-12-31 13:53

I have been struggling to load the rJava package in R.

I get the following messages

> library(rJava)
Error in inDL(x, as.logical(local), as.logic         


        
6条回答
  •  悲哀的现实
    2020-12-31 14:35

    After editing your post for readability / formatting it seems that you have no Java system in your path. I don't use the OS you're trying to use this on, but on mine rJava only works if I also install a Java Run-Time Environment or, better still, a Java SDK.

    Note that the package clearly lists

    SystemRequirements: java
    

    and that the rJava site clearly states the following

    Installation

    First, make sure you have JDK 1.4 or higher installed (some platforms require hgher version see R Wiki). On unix systems make sure that R was configured with Java support. If not, you can re-configure R by using R CMD javareconf (you may have to prepend sudo or run it as root depending on your installation - see R-ext manual A.2.2 for details). On Windows Java is detected at run-time from the registry.

    rJava can be installed as any other R package from CRAN using install.packages('rJava'). See the files section in the left menu for development versions.

    JRI is only compiled if supported, i.e. if R was configured as a framework or with --enable-R-shlib.

    so I think we have a few smoking guns pointing the same way.

提交回复
热议问题