# read the help file to identify the arguments needed to
PRO TIP: The easiest way to work around this problem is to use an R package that does not depend on Java, such as openxlsx or readxl.įor openxlsx, it's very easy. Solution 1: Use an excel reader package that doesn't require Java rJava requires the Java Runtime Environment 1.2 or above to also be present on one's computer. The xlsx package depends on the rJava and xlsxjars packages.
Java runtime not installedįirst, many new R users have not previously needed to install a Java runtime on their computers. I suppose this is not the way it should be configured.R users who have not previously used packages that rely on Java often have problems when attempting to use the xlsx package that is used to read Excel spreadsheets. Sudo ln -s /Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home/lib/server/libjvm.dylib libjvm.dylib Sudo mkdir /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/Ĭd to it and create a symbolic link to existing libjvm.dylib: Only way I can get it work is an ugly trick: R from command line works perfectly and is configured for java with R CMD javareconf. I've tried dyn.load(paste0(system('/usr/libexec/java_home -v 11', TRUE), '/lib/server/libjvm.dylib') but nothing helps. I've tried setting JAVA_HOME,DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH in. Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.soĭoes exist, so this image not found error that r is throwing doesn't help much.
Updating Java configuration in /Library/Frameworks/R.framework/Resources JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm JNI cpp flags : -I(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin Java library path: (JAVA_HOME)/lib/server JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home framework R -Wl,-framework -Wl,CoreFoundation Java home path : /Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Homeĭetected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwinĭetected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvmĬlang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home/include/darwin -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c conftest.c -o conftest.oĬlang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home/lib/server -ljvm -F/Library/Frameworks/R.framework/. If it helps, this is the output from javareconf This is confusing, as I thought the javareconf command was supposed to take care of the necessary environment variables, so I'm not sure why it won't work. Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so )Įrror: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so':ĭlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
onLoad failed in loadNamespace() for 'rJava', details:Ĭall: dyn.load(file, DLLpath = DLLpath. When I try to load the rJava library, this is the errorĮrror: package or namespace load failed for ‘rJava’: I tried reinstalling rJava, but that also didn't help. I checked the traceback of the XLConnect library error to confirm that the problem is rJava. Java HotSpot(TM) 64-Bit Server VM (build 13+33, mixed mode, sharing) Java(TM) SE Runtime Environment (build 13+33) Everything worked apart from XLConnect, because it has that pesky java dependancy, so I installed JRE first and the JDK. So I have a clean install of macOS, I installed R and Rstudio, then started to install the packages I use.
Yesterday, however, I decided it was time to do a clean install of my mac for reasons that I won't go into. I was previously using XLConnect as part of a notebook successfully. This might be more of a general R environment problem, but I came across it while trying to load XLConnect after a clean reinstall, so I figured I'd try here.