Apple M1 - Cannot Load rJava for xlsx package in R

372 Views Asked by At

I am currently working on an assignment that requires me to utilize the xlsx package in R. I have installed both "xlsx" and "rJava" packages, and have installed the most recent edition of Java to my computer.

However, when I try to load the "xlsx" package, I receive the following error: enter image description here

> library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(jli, FALSE)
  error: unable to load shared object '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib':
  dlopen(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

Any suggestions of how to fix this so I am able to use the xlsx package?

Thanks.

Tried searching for solutions that suggested I used a different non-Java based package to open the files, read it may be M1 Mac incompatible with Java.

0

There are 0 best solutions below