0

While installing qdap I have not faced any errors. But when loading the library, I face the follwing errors.

> library(qdap)
Loading required package: qdapDictionaries
Loading required package: qdapRegex
Loading required package: qdapTools
Loading required package: RColorBrewer
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry

I read in another question that we need to install the JAVA 64bit (as my Win 10 is 64-bit) and load the JAVA home. So I downloaded the 64-bit java file and also set the JAVA_HOME to the directory.

> Sys.setenv(JAVA_HOME='C:/Program Files (x86)/Java/jre1.8.0_231')
> library(qdap)
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/Admin/Documents/R/win-library/3.6/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

I have uninstalled and installed the latest R software (3.6.2; I've checked both 32-bit and 64-bit options), restarted R-studio as well, to no avail.

Rui Barradas
  • 70,273
  • 8
  • 34
  • 66
Salih
  • 391
  • 1
  • 13
  • 2
    Maybe you can check the instsallation of `rJava` https://stackoverflow.com/questions/32366151/install-rjava-in-r – akrun Jan 06 '20 at 16:05
  • @akrun Thanks for looking into it. I see that on Rgui(32-bit) (opened from the directory C:\Program Files\R\R-3.6.2\bin\i386 ), the library(rJava) works well and so does load(qdap). is there a way where we can force the Rstudio to work on 32-bit R ? – Salih Jan 06 '20 at 16:18

1 Answers1

0

The issue is fixed. Although I'm not 100% sure what solved, here is what i have done.

The error %1 is not a valid Win32 application. is indicating 32-bit.

So I started Rgui console (32-bit) (opened from the directory C:\Program Files\R\R-3.6.2\bin\i386 ). The library(rJava) command works well and so does library(qdap).

Then I changed the options in Rstudio to choose 32-bit R [Tools -> Options -> General]. But setting this will impact high memory consuming executions. After a while (when I started facing memory issues), I switched the RStudio to use the 64-bit R.

The error did not appear after that and I was able to load the 'qdap' library.

Salih
  • 391
  • 1
  • 13