Failed loading rJava.dll using Rscript - r

I run R 3.0.1 through Eclipse and have no problem. I tried to execute some of my R scripts using Rscript.exe but i get the following error:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'H:/R/R-3.0.1/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified path is invalid.
I have checked and the DLL exists in the directory.
Do you have any suggestion?
Thanks.
Regards

Solved by Adding
if (Sys.getenv("JAVA_HOME")!="")
Sys.setenv(JAVA_HOME="")

Related

qdap, rJava load failed

I have successfully installed all the libraries but below error is not going away
I have tried 3 JDK java-se-8u41-ri ; openjdk11 ; openjdk8 and below error keeps coming, when I open in R-Studio it works but not whe i try to make exe using electron, please advise
stderr: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//R-Portable-Win/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.

Using any Library to Read Excel files from R

I have R installed in a usb stick (since I'm using work computer and don't have Admin access to install software), and so far I've been having to resort to read.csv() since I can't use any library to read excel files.
For example, XLConnect gives the problem of :
>Error: package or namespace load failed for ‘XLConnect’:
>> .onLoad failed in loadNamespace() for 'rJava', details:<br>
>> call: inDL(x, as.logical(local), as.logical(now), ...)<br>
>> error: unable to load shared object 'D:/R/R-4.0.2/library/rJava/libs/x64/rJava.dll':<br>
> LoadLibrary failure: %1 is not a valid Win32 application.<br>
>In addition: Warning message:
>package ‘XLConnect’ was built under R version 4.0.3
It seems that these libraries (readxl, xlsx, or XLConnect) are failing because they don't know where I have Java installed. So, I also did this:
Sys.setenv(JAVA_HOME='C:\Program Files (x86)\Java\jre1.8.0_131\bin')
but, to no avail. (that advice I got it from https://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/)
If someone knows how to read excel files using R from a memory stick - I would really appreciate if they can point north to me.
btw, this is the error when loading xlsx library:
> library(xlsx)
>Error: package or namespace load failed for ‘xlsx’:
>> .onLoad failed in loadNamespace() for 'rJava', details:<br>
>> call: inDL(x, as.logical(local), as.logical(now), ...)<br>
>> error: unable to load shared object 'D:/R/R-4.0.2/library/rJava/libs/x64/rJava.dll':<br>
>> LoadLibrary failure: %1 is not a valid Win32 application.
<br>
>In addition: Warning message:<br>
>package ‘xlsx’ was built under R version 4.0.3
and this is the error when trying to read an excel file with readxl (no problem when loading):
>*Error in loadNamespace(name) : there is no package called ‘cli’*
This is it, this did it:
"You may want to check out this posting: stackoverflow.com/questions/29254067/…" – SteveM 16 hours
Thank you kind stranger.

Can't load any packages in RStudio

I'm very new to R and I'm having problems right off the bat. None of the packages want to load and each time I try, the same error message is being given (see below). What am I doing wrong? Thanks in advance for any help!
library(xlsx)
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package ‘rJava’ could not be loaded
I have since added JAVA_HOME to my environmental variables but now when I attempt to load a package, a new error pops up (See Below)
library(xlsx)
Loading required package: 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/Sam/Documents/R/win-library/3.3/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error: package ‘rJava’ could not be loaded

cannot load R package 'tm.plugin.webmining'

I'm using x64 windows 7 and R i386 3.1.1
I installed 'tm.plugin.webmining' package. but when I load this package using
library(tm.plugin.webming)
flowing error occure:
Error : .onLoad is failed at loadNamespace() because of 'rJava':
Call: inDL(x, as.logical(local), as.logical(now), ...)
Error: Cannot load 'C:/Program Files/R/R-3.1.1/library/rJava/libs/i386/rJava.dll':
LoadLibrary failure: Cannot find the module.
I already installed latest jvm. But it doesn't work.
try setting the Java_Home path on R
Sys.setenv(JAVA_HOME="path/java/home")
ie
Sys.setenv(JAVA_HOME=C:/Program Files/Java/jdk1.8.0_05/bin")

Rmpi.dll "could not be found" with DeinoMPI and Rmpi

I'm trying to set up MPI with DeinoMPI on Windows. I've installed DeinoMPI and have my cluster set up there, but when I run library(Rmpi) after starting Rgui.exe through the cluster I get the following error:
> library(Rmpi)
Error : .onLoad failed in loadNamespace() for 'Rmpi', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'D:/Programs/R-3.1.0/library/Rmpi/libs/x64/Rmpi.dll':
LoadLibrary failure: The specified module could not be found.
In addition: Warning message:
package ‘Rmpi’ was built under R version 3.1.1
Error: package or namespace load failed for ‘Rmpi’
Looking at that directory, Rmpi.dll is present in the directory and has read/write access. Anyone have any ideas why it says 'the specified module could not be found'? Or is there some additional config necessary perhaps?
Additionally, if I run Rgui.exe outside of the DeinoMPI cluster and run library(Rmpi), I receive the following pop-up:

Resources