javar32bit-64bitrjavareporters

Unable to load rJava.dll - not a valid Win32 application - while installing ReporteRsjars


I am having problems installing ReporteRsjars package on my 64 bit R, 64 bit Windows 10 machine. The ReporteRsjars package was downloaded from the CRAN archive (tar.gz file) and installed from a local folder.

R is saying that it can't load rJava.dll and seems to be looking for a 32 bit rJava.dll file (error message: not a valid Win32 application). I have no idea why it's doing this.

I have installed the rJava package and calling library(rJava) seems to load the rJava package without any problems.

I've also installed openJDK version 11 (64 bit), a zip file downloaded from http://jdk.java.net/11/. There was no Windows installer, so I just unzipped it into C:\Program Files\Java and added a few system environment variables: C:\Program Files\Java\jdk-11\bin and C:\Program Files\Java\jdk-11\bin\server

And created a system environment variable: JAVA_HOME = C:\Program Files\Java\jdk-11

Typing java -version on the Windows command prompt confirms my machine has openJDK 11, OpenJDK Runtime Environment 18.9. and OpenJDK 64 bit server 18.9.

I don't know where I've gone wrong - would be grateful for any tips to get ReporteRsjars installed properly.

 install.packages("C:/Users/h/Downloads/ReporteRsjars_0.0.4.tar.gz", repos = NULL, type = "source")
'\\u\h\Documents'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
* installing *source* package 'ReporteRsjars' ...
** package 'ReporteRsjars' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
No man pages found in package  'ReporteRsjars' 
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'ReporteRsjars':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Program Files/R/R-3.5.1/library/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Program Files/R/R-3.5.1/library/ReporteRsjars'
* restoring previous 'C:/Program Files/R/R-3.5.1/library/ReporteRsjars'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘C:/Users/h/Downloads/ReporteRsjars_0.0.4.tar.gz’ had non-zero exit status

Solution

  • You will need to install both 32 and 64 bit java version as you are trying to install the package for R 32 and R 64 bit version. Also I think JAVA_HOME is not necessary. If installations have been done correctly, you should not need any additional env. variable.