Unable to load RJDBC package in RStudio - r

I have successfully installed the RJDBC in RStudio.
install.packages("RJDBC")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/RJDBC_0.2-7.zip'
Content type 'application/zip' length 70232 bytes (68 KB)
downloaded 68 KB
package ‘RJDBC’ successfully unpacked and MD5 sums checked
However when I load RJDBC on Windows 7 64-bit. However I get the following error.
The downloaded binary packages are in
C:\Users\abhish\AppData\Local\Temp\Rtmp0oCqXi\downloaded_packages
> library(RJDBC)
Loading required package: 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:/Program Files/R Foundation/R/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified path is invalid.
Error: package ‘rJava’ could not be loaded
In addition: Warning messages:
1: package ‘RJDBC’ was built under R version 3.4.3
2: package ‘rJava’ was built under R version 3.4.3

Related

The package Rmpi is already installed, but R returns "Loading required package: Rmpi"

I'm trying to run parallel computing. Hence I install package Rmpi.
install.packages("Rmpi")
require("Rmpi")
Could you please elaborate why there is such error message while I've just installed the package?
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into �C:/Users/Dung Le/Documents/R/win-library/4.0�
(as �lib� is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Rmpi_0.6-9.zip'
Content type 'application/zip' length 353588 bytes (345 KB)
downloaded 345 KB
package ‘Rmpi’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Dung Le\AppData\Local\Temp\RtmpGm7Riu\downloaded_packages
Loading required package: Rmpi
Error: package or namespace load failed for �Rmpi�:
.onLoad failed in loadNamespace() for 'Rmpi', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/Dung Le/Documents/R/win-library/4.0/Rmpi/libs/x64/Rmpi.dll':
LoadLibrary failure: The specified module could not be found.
PS: I use Windows 10 Pro with version 2004 and build 19041.508. My R is 4.0.2.

.onLoad failed in loadNamespace() for 'rJava [duplicate]

This question already has answers here:
"unable to load shared object" when loading the rJava library
(2 answers)
Closed 3 years ago.
I am running Win 10 64-bi with Java version 1.8.0.221. when loading xlsx package I am getting an error in R Studio with version 3.5.2 - also 64-bit.
The error is in loading rJava.
any thoughts on how can I fix this? I am stuck and can't move forward. Thanks.
trying URL 'https://mran.microsoft.com/snapshot/2019-02-01/bin/windows/contrib/3.5/xlsx_0.6.1.zip'
Content type 'application/zip' length 458979 bytes (448 KB)
downloaded 448 KB
package ‘xlsxjars’ successfully unpacked and MD5 sums checked
package ‘xlsx’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\<user>\AppData\Local\Temp\RtmpIZaYPe\downloaded_packages
> library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/<user>/Documents/R/win-library/3.5/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found.
I added the following and then rJava loaded without error.
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_221')

Error : package 'rJava' could not be loaded but library(rJava) is working

I've 64 bit machine and have installed jdk and jre(64 bit) also R and R studio is 64bit. I'm trying to install 'rMongodb' package by:
devtools::install_github("tc/RMongo")
but it gives out error
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/saini/OneDrive/Documents/R/win-library/3.5/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error : package 'rJava' could not be loaded
Error: loading failed
Execution halted
*** arch - x64
Warning: package 'rJava' was built under R version 3.5.2
ERROR: loading failed for 'i386'
* removing 'C:/Users/saini/OneDrive/Documents/R/win-library/3.5/RMongo'
In R CMD INSTALL
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/saini/AppData/Local/Temp/RtmpuEHfqO/file20f419985c01/RMongo_0.1.0.tar.gz’ had non-zero exit status
Even though library(rJava) works fine.
Ps. I've already set the environment variables.

R: Error message installing a package, how to get around it?

I am having an error installing XLConnect for R, this is the error message I get:
> install.packages("XLConnect")
Installing package into ‘C:/Users/a_garcia_de_paredes/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/XLConnect_0.2-13.zip'
Content type 'application/zip' length 9633752 bytes (9.2 MB)
downloaded 9.2 MB
package ‘XLConnect’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\a_garcia_de_paredes\AppData\Local\Temp\RtmpKA18my\downloaded_packages
> library("XLConnect")
Loading required package: XLConnectJars
Error: package or namespace load failed for ‘XLConnectJars’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package ‘XLConnectJars’ could not be loaded
Is there a way to get around it?

Error (as ‘lib’ is unspecified) to install rjava

I am installing rJava on a 64bit machine, running Windows 7, and am encountering the weirdest message. Below is the log. Has anyone seen this before? Thanks in advance.
install.packages("rJava")
Installing package into ‘C:/Users/laila.rothe/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/rJava_0.9-6.zip'
Content type 'application/zip' length 761928 bytes (744 KB)
downloaded 744 KB
package ‘rJava’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\laila.rothe\AppData\Local\Temp\RtmpmcecQy\downloaded_packages
library(rJava)
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/laila.rothe/Documents
R/win-library/3.2/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found.
Error: package or namespace load failed for ‘rJava’

Resources