1

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.

JStark
  • 11
  • 1
  • 1
    The “readxl” can open Excel files but without the Java requirement. – Dave2e Nov 23 '22 at 02:56
  • If you only need to read files, the `readxl` package is a good choice. There's also a `writexl` package that doesn't depend on Java. Java dependencies are notoriously difficult to troubleshoot for R so if you can avoid them, do! – neilfws Nov 23 '22 at 02:56
  • Install Java: https://stackoverflow.com/questions/67849830/how-to-install-rjava-package-in-mac-with-m1-architecture I think the advice to skip Java will make several other packages fail to install. – IRTFM Nov 23 '22 at 03:26

0 Answers0