Java problem on Mac Mojave Solved

Hi guys,

I have Mac Mojave Version 10.14.5 and R version 3.5.2. (64-bit).

I could not use xlxs package, got the following error:

"Error: package or namespace load failed for ‘xlsx’:
.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.5/Resources/library/rJava/libs/':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/
Reason: no suitable image found. Did find:
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjvm.dylib: mach-o, but wrong architecture
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libclient.dylib: mach-o, but wrong architecture"

Solution that finally solved the problem after trying several other methods:

1.Installing Java SE Development Kit from here:

  1. Running the following at terminal:
    sudo R CMD javareconf

  2. Restarting R Studio.

This is the standard procedure when you install/update java on windows too :roll_eyes:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.