sbac
sbac

Reputation: 2081

rJava does not run on macOS Sierra

I am using macOS Sierra and R version 3.4.0. I installed the package "rJava" using RStudio:

install.packages("rJava")
Warning in install.packages :
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/rJava_0.9-8.tgz'
Content type 'application/x-gzip' length 627959 bytes (613 KB)
==================================================
downloaded 613 KB


The downloaded binary packages are in
    /var/folders/tq/f5jbfqp97y52w_y7byn05_fw0000gn/T//RtmpTdEVbA/downloaded_packages

Then when I try to run rJava I get:

> require(rJava)
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
  Reason: image not found

Upvotes: 1

Views: 4164

Answers (1)

Oo.oO
Oo.oO

Reputation: 13375

R, rJava and Java are little bit messy in macOS. In general, you have to make sure to properly configure all the elements. There is a clash between Oracle's and Apple's version.

Take a look here for very detailed instructions: R, Java, rJava and macOS adventures

I don't post the content here - it's quite long.

Upvotes: 2

Related Questions