Issues with installing rJava or qdap in R

3k Views Asked by At

when trying to install qdap or rJava, it's always returning image not found error

library(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 Blockquote

I followed every instruction on this earlier thread, still doesn't work, same error msg.

R version 3.4.0 (2017-04-21) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: OS X El Capitan 10.11.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

4

There are 4 best solutions below

0
On

For the one having issues in relation to rJava or qdap installation, many of the fixes described in forums did not work for me. However, the following was successful:

https://github.com/MTFA/CohortEx/wiki/Run-rJava-with-RStudio-under-OSX-10.10,-10.11-(El-Capitan)-or-10.12-(Sierra)

I just changed for the latest version of r. Once rJava was correctly installed, qdap was installed without any problem.

0
On

Uninstall all versions of Java available in your system. And freshly download the 64bit version of Java. Then install "rJava". This would probably resolve this issue. It worked for me.

1
On

This could help:

Sys.setenv(JAVA_HOME="C:/Program Files/Java/jre1.8.0_112")

Change to your path to Java.

0
On

It might be worth to look here:

http://www.owsiak.org/?p=3671

I was struggling with R, rJava and Java for some time (macOS) and eventually I have figured out how to make it work quite smooth.

There are few things you have to pay attention to:

  • whether you use Oracle's Java or Apple's one
  • whether you have JNI enabled inside JDK
  • whether R properly finds your JDK installation

Give it a try and see whether my steps will help you with this one.