RJava and XLConnect in RStudio not loading - r

First the tech specs of what I am using:
RStudio 0.98.983
R 3.1.1 (64 Bit)
Windows 8.1
When trying to load XLConnect I receive the following error
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package or namespace load failed for ‘XLConnect’
When trying to load RJava I receive the following error
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package or namespace load failed for ‘rJava’
I've checked to make sure the newest updates are installed from CRAN. However I am out of ideas and new to R. Does anyone know how to fix this?

Here is what I posted before:
Meanwhile, I am right now having the problem with the relenium package, which can't locate rJava.
Version mismatches can bedevil you. Check that if your version of R is 32 byte, so must your Java version be. Or, 64 byte must match 64 byte.
Second, I ended up adding to my PATH (I am on Windows 8) the location of the jv.dll file that XLConnect needs (I think that was the name of the file). I found the PATH through Control Panel and System Environment (and maybe more).
Third, the Java site will verify that you have Java installed.
Fourth, with the matching architecture and the PATH pointing to the needed .dll file, I rebooted and it all worked.
Good luck.

Related

rjags installation error, can't find JAGS path on Windows

I'm having an issue getting rjags to load & run. I can install rjags, but it doesn't run because it can't find JAGS. My versions are listed below and are all updated to the latest versions. I'm also using a Thinkpad.
JAGS Version: 4.3.0
RStudio Version: 2021.09.0 Build 351
Installation of rjags is okay using the following command:
install.packages('rjags',configure.args="--enable-rpath")
Error messages recopied below:
library(rjags)
Warning: package ‘rjags’ was built under R version 4.0.5
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: fun(libname, pkgname)
error: The environment variable JAGS_HOME is set to
C:/ProgramData/Microsoft/Windows/Start Menu/Programs/JAGS/JAGS-4.3.0
but no JAGS installation can be found there
If I go to where JAGS is installed, the path is:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\JAGS
I used the above lines shared to try and solve this problem, but to no avail:
Sys.setenv(JAGS_HOME="C:/ProgramData/Microsoft/Windows/Start Menu/Programs/JAGS/JAGS-4.3.0")
Error: unexpected '/' in "Sys.setenv(JAGS_HOME=C:/"
Corrected to:
Sys.setenv(JAGS_HOME="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\JAGS\JAGS-4.3.0")
Error: '\P' is an unrecognized escape in character string starting ""C:\P"
Corrected to:
Sys.setenv(JAGS_HOME="C:\ ProgramData\ Microsoft\ Windows\ Start Menu\ Programs\ JAGS\ JAGS-4.3.0")
This doesn't yield any errors, but when I try to load rjags I get the following:
library(rjags)
Warning: package ‘rjags’ was built under R version 4.0.5
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: fun(libname, pkgname)
error: The environment variable JAGS_HOME is set to
C: ProgramData Microsoft Windows Start Menu Programs JAGS JAGS-4.3.0
but no JAGS installation can be found there
This is the same as above, but the / are left out for some reason.
Unsure of what to try next, any thoughts/insight would be much appreciated! :)
This seems to be an issue others have faced too: rjags failed to load and R Failed to locate any version of JAGS
https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/060fd5c378/?limit=25
https://www.reddit.com/r/rstats/comments/pzto5t/rjags_is_my_enemy/
Though none of these solutions seem to be working (yet?).
Problem solved!
Both of you were right - JAGS was in an odd location, so I moved it to:
C:\Program Files\JAGS\JAGS-4.3.0
And then used the code (I think / is the same as \):
Sys.setenv(JAGS_HOME="C:/Program Files/JAGS/JAGS-4.3.0")
And now it works like a charm :)

rJava "EXTPR_PTR" procedure entry point not found in library

I'm attempting to install rJava as to use the package tabulizer. My steps so far has been to rund install.packages("rJava"), run Sys.setenv(JAVA_HOME="C:/Program Files/Java/jdk-15.0.1"), and then run library(rJava). When running the last command I first get a pop-up showing EXTPTR_PTR Entry Point for procedure not found (based on my hopeful translation), and then in console:
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: NULL
error: .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'D:/TidlPic/Eric/Documents/R/win-
library/4.0/rJava/libs/x64/rJava.dll'
I have made sure I have the latest version of both the JRE and JDK versions of Java, and that both them and R are the 64bit versions. I've also attempted at pointing the Java_Home path to either one of them, as well ast just ../Java, and they all return the same error. Any clues on what it is wrong? All help appreciated!
There was accidental breakage introduced by R 4.0.0 or R 4.0.1 which was fixed in R 4.0.2 and R 4.0.3. Are you by chance running 4.0.1? Upgrading would help.
The official word from one R Core member is to not use EXTPTR_PTR (see e.g. this list email). The current CRAN version of rJava should also be fine.
So in short: 'current' rJava with 'current' R should be fine.

Package ("qdap") fails to load with multiple errors

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.
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.

error in installing RWeka package in R

After getting RWeka package is sucessfully unpacked, when command library("RWeka") is executed it is showing an error:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname) error: No CurrentVersion entry in
Software/JavaSoft registry! Try re-installing Java and make sure R and
Java have matching architectures. In addition: Warning message:
package ‘RWeka’ was built under R version 3.2.3 Error: package or
namespace load failed for ‘RWeka’
As the error states, make sure you have Java installed of the same architecture as R. For example if you have 32-bit R, you need to have 32-bit Java installed.
If your system is 32 bit, get yourself a 32-Bit java. If the system is 64-Bit go for 64bit java. I faced the same issue as my system is 64-Bit and i accidentally installed 32-Bit java. Uninstalled and reinstalled a 64-bit. Sorted now.

Error loading rJava in R (Ubuntu 12.04)

I had some issues installing rJava first. Then I found this solution.
Unfortunately I get following error, when loading the package:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/informatik2/students/home/1jendryc/R/x86_64-pc-linux-gnu-library/3.1/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: package or namespace load failed for ‘rJava’
Still this file exists and even the path is correct
~/R/x86_64-pc-linux-gnu-library/3.1/rJava/libs$ ls
rJava.so
So I tried that approach, but it didn't worked.
I have no possibility to get root easily, cause I am working at my university at a pool computer.
Cheers.
Your issue is something different. What message says is that it can't find "libjvm.so". You need to properly configure Java, rJava and R. Take a look here
http://www.owsiak.org/?p=3671
where all the caveats are listed when it comes to working with R and Java.

Resources