LoadLibrary failure RJava

I’ve been trying to load the qdap package, searching on here and troubleshooting, – realised Java couldn’t be found. Uninstalled and downloaded Java – assuming I’ve done the correct 64 bit version as I am assuming I have RStudio 64 by checking

> R.Version()
$platform
[1] "x86_64-w64-mingw32"

I’m using “R version 3.4.3 (2017-11-30)” and Windows 10

Followed the advice here and set the following

Sys.setenv(JAVA_HOME='C:\Program Files(x86)\Java\jre1.8.0_181')

ran this

find.java <- function() {
  for (root in c("HLM", "HCU")) for (key in c("Software\JavaSoft\Java 
Runtime Environment", 
                                              "Software\JavaSoft\Java 
Development Kit")) {
    hive <- try(utils::readRegistry(key, root, 2), 
                silent = TRUE)
    if (!inherits(hive, "try-error")) 
      return(hive)
  }
  hive
   }

Got this

find.java()

   > find.java()
   $`Security Baseline`
   $`Security Baseline`$`1.4.2`
   [1] "1.4.2_99"

   $`Security Baseline`$`1.5.0`
  [1] "1.5.0_99"

   $`Security Baseline`$`1.6.0`
   [1] "1.6.0_201"

   $`Security Baseline`$`1.7.0`
   [1] "1.7.0_191"

   $`Security Baseline`$`1.8.0`
  [1] "1.8.0_181"

Assumed this means Java can now be found. Also did this to check.

> system("java -version")
   java version "1.8.0_181"
   Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
   Java HotSpot(TM) Client VM (build 25.181-b13, mixed mode, sharing)

So try to load rJava again.

> library(rJava)
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 
'C:/Users/grant/OneDrive/Documents/R/win-library/3.4/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.
   In addition: Warning message:package ‘rJava’ was built under R version 3.4.4 

I’ve tried to follow the advice given in here and as shown above I know I have Java and a Java Run Time Environment and I have followed some of the suggested fixes already. I haven’t done the PATH fixes as I’m not sure what exactly my PATH is, if it’s wrong and how to change the PATH or put server in path. I’ve got as far as this but not sure how to decipher it.

> Sys.getenv("Path")[1] "C:\Rtools\bin;C:\Program Files\R\R-3.4.3\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\grant\AppData\Local\Microsoft\WindowsApps;"

I’ve also tried downloading and using Dependency Walker and didn’t understand it.

Have I made an error in my assumptions? Is there an issue with my Path and if so how does Path get changed? Or is there anything else I can try?

Leave a Reply

avatar
  Subscribe  
Notify of