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

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’

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')

Unable to load RJDBC package in RStudio

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

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?

R connect to Oracle - library(ROracle) fail

It won't load the library.
setwd("C:/Users/***/Desktop")
install.packages('ROracle_1.2-1.zip', repos = NULL)
#Installing package into ‘C:/Users/***/Documents/R/win-library/3.3 (as ‘lib’ is unspecified)
#package ‘ROracle’ successfully unpacked and MD5 sums checked
library('ROracle')
#Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/***/Documents/R/win-library/3.3/ROracle/libs/x64/ROracle.dll': LoadLibrary failure: The specified module could not be found.
I manually checked the file path and ROracle.dll is there.
EDIT:
I have RODBC and RJDBC working. I just don't understand why ROracle won't install:
library(ROracle)
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/robsoo01/Documents/R/win-library/3.3/ROracle/libs/x64/ROracle.dll':
LoadLibrary failure: The specified module could not be found.
Error: package or namespace load failed for ‘ROracle’
install.packages("ROracle")
Installing package into ‘C:/Users/***/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘ROracle’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘ROracle’
trying URL 'https://cran.rstudio.com/src/contrib/ROracle_1.2-2.tar.gz'
Content type 'application/x-gzip' length 304229 bytes (297 KB)
downloaded 297 KB
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
ERROR: cannot find Oracle Client.
Please set OCI_LIB64 to specify its location.
Warning: running command 'sh ./configure.win' had status 1
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Users/***/Documents/R/win-library/3.3/ROracle'
* restoring previous 'C:/Users/***/Documents/R/win-library/3.3/ROracle'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" CMD INSTALL -l "C:\Users\***\Documents\R\win-library\3.3" C:\Users\***\AppData\Local\Temp\RtmpMvcLO4/downloaded_packages/ROracle_1.2-2.tar.gz' had status 1
Warning in install.packages :
installation of package ‘ROracle’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\***\AppData\Local\Temp\RtmpMvcLO4\downloaded_packages’
I'm guessing there are Oracle files that need installing, but none of the documentation is very clear.
In order for ROracle to install and load properly, you should have Oracle Client 64-bit and Windows 64-bit. Once I installed 64-bit Oracle Client on my machine, this error went away.

Resources