0
votes

I keep getting the same error, for both first for XLConnect, (which I thought was a java problem) and now rJava (which is also not working). This is the error message I get when I library(rJava):

Error: package or namespace load failed for ‘rJava’: .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so':
dlopen(/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib Referenced from: /Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so Reason: image not found

I am new to R, and just need to figure out how to get these packages working, thanks!

2
Are you just trying to read Excel file in R? It would probably be easier to use a package like readxl that doesn't have a Java dependency.MrFlick

2 Answers

0
votes

Try (check your java version and change accordingly):

Sys.setenv(JAVA_HOME = "C:/Program Files/Java/jre-9.0.1")

And then load library.

Install package xlsx if you are trying to access Excel file by entering install.packages("xlsx", dependencies = T) in your console.

0
votes

Another R package for working with excel data which does not require rJava is openxlsx. I've found it works faster than java-based packages, which is a nice bonus.