javarrjava

Struggling with rJava and dependent packages in Rstudio Mac M1. Error: package or namespace load failed for ‘rJava’:


I'm really struggling with rJava. I have a new machine (Mac M1) and am running r code from an older project on an old intel Mac, and it isn't working at all. I am not especially familiar or confident with this, or using the terminal so please bare this in mind when answering :)

The error message I am getting is:

 .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 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (no such file), '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
I think one issue is that if I run
$/usr/libexec/java_home /usr/libexec/java_home /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home 

It thinks java is not in the right place?

I tried to rectify this by doing: JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home but it doesn't seem to make a difference.

Grateful for any advice


Solution

  • This was rectified by downloading Azul https://www.azul.com/core-post-download/?endpoint=zulu&uuid=cf6e06ec-c897-4b5a-9859-e1c547ff5864