0

Updated: After referring to the post here: rJava load error in RStudio/R after "upgrading" to OSX Yosemite I have solved the problem. This one was useful too. Loading rJava on Mac OS High Sierra

I am trying to install and require package "XLConnect". And I have Java installed, when I was trying to update it. The screenshot I got was as below, showing I have a newer Java version. enter image description here

The error messages I've got was as below, and I installed the package "XLConnectJars" as the error message mentioned it. But still did not solve the problem. I wonder have anybody had the same issue before? Any suggestion and assistance would be highly appreciated.

> library("XLConnect")
Loading required package: XLConnectJars
Error: package or namespace load failed for ‘XLConnectJars’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object 


'/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':


dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
          Referenced from: 

/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
          Reason: image not found
        Error: package ‘XLConnectJars’ could not be loaded
        > install.packages("XLConnectJars")
        trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/XLConnectJars_0.2-15.tgz'
        Content type 'application/x-gzip' length 14810717 bytes (14.1 MB)
        ==================================================
        downloaded 14.1 MB


        The downloaded binary packages are in
            /var/folders/v3/4tfsblxs1m314g6pl2bt4t7r0000gn/T//RtmpBJ5q5u/downloaded_packages
        > library("XLConnectJars")
        Error: package or namespace load failed for ‘XLConnectJars’:
         .onLoad failed in loadNamespace() for 'rJava', details:
          call: dyn.load(file, DLLpath = DLLpath, ...)
          error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
          dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
          Referenced from: 

    /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
              Reason: image not found
Chen
  • 383
  • 2
  • 12
  • 1
    Have you already tried re-downloading and installing Java from Oracle's website?: https://www.java.com/en/download/manual.jsp – Mako212 Aug 21 '18 at 16:58
  • 1
    Also, you may need to run `install.packages("rJava", type = 'source')` – Mako212 Aug 21 '18 at 16:59
  • @Mako212 Thanks! I am searching for those info and I am gonna try on that. Thanks! – Chen Aug 21 '18 at 17:35

0 Answers0