JavaGD fails to load - r

Could someone please help.
I had Deducer working with R 2.14 but now that I have updated to 2.15.1 I can't get JGR to load. I have loaded JGR and Deducer.
This is the message I get when installing
Loading required package: JavaGD
Error : .onLoad failed in loadNamespace() for 'JavaGD', details:
call: .Call("RegGetStrValue", c(key, "CurrentVersion"), PACKAGE = "JavaGD")
error: C symbol name "RegGetStrValue" not in DLL for package "JavaGD"
Error: package ‘JavaGD’ could not be loaded
I have removed all old versions of R and Ver 2.15.1 - reinstalled R and still get this message.
Is it possible that this is a Registry problem and if so where should I look.
I have searched and although there seem to be simiar reported issues, none are exactly the same from the ones that I have seen. I certainly dont seem to have m,ultiple versions of JavaGD in my library and the Namesake file is in the folder JavaGD.
I am running Win 7 32 bit ver on fairly current Dell Laptop.
R seems to work fine and I am using R-Studio most of the time and that works fine as well.
Any help would be appreciated

7 years on form the OP's original issue choosing the right Java Download is critical for 64-bit machines which most of our RStudio environments are synced to work with. For whatever reason, downloading the 64-bit JRE is difficult. To avoid the same error presented by Deducer more recently be sure to download the 64-bit Java JRE from https://www.java.com/en/download/manual.jsp. Note, the 64-bit version must be downloaded offline as instructed (usually bottom of Windows downloads). Check that the installation path is c:\Program Files\Java and not c:\Program Files(x86)\Java. That plus the JDK should fix this problem going forward.

Related

Error loading XLConnect (loadNamespace error, argument is of length zero)

When loading
library(XLConnect)
I get the error message
Error: package or namespace load failed for ‘XLConnect’:
.onLoad failed in loadNamespace() for 'XLConnect', details:
call: if (twoFirst == "1.") {
error: argument is of length zero
This program has been working smoothly for months, this is out of the blue after no changes to the code. I have seen that many issues have come from Java, and have installed latest Java (V8 update 281) in 32 and 64-bit flavors. In addition, I have tried switching RStudio to 32 bit from 64 with no change in the result. Also have reinstalled the XLConnect package, rJava package, restarted, ensured R is running as administrator, all with still the same error.
What happened and why is it not loading?
Running R 4.0.4 and RStudio 1.4.1103 on Windows 10 x64.
I will probably switch to readxl after this, but that will take time.
One of my students was experiencing exactly the same problem mentioned above (in our case, with R version 4.0.3 in Windows 10, Java 1.8) and no solution was working for him. However, a few minutes ago, exploring his environment variables, we noticed that he had environment variable _JAVA_OPTIONS set to -Xmx512m. Once we have removed such variable, XLConnect is working properly.

error installing xlsx package with object not loaded [duplicate]

While loading rJava package, I receive this error:
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/ankitagarwal5/Documents/R/win-library/3.2/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
In addition: Warning message:
package ‘rJava’ was built under R version 3.2.3
Error: package or namespace load failed for ‘rJava’
I referred various posts on StackOverflow and tried to make changes accordingly, but nothing worked. These are the various steps I followed to resolve the issue:
if (Sys.getenv("JAVA_HOME")!="")
Sys.setenv(JAVA_HOME="")
library(rJava)
This didn't work.
Then I tried this:
options(java.home="C:\\Program Files\\Java\\jre1.8.0_91\\")
library(rJava)
This didn't work either.
My jvm.dll is at this location in my Windows 7 64 bit OS - C:\Program Files (x86)\Java\jre1.8.0_91\bin\client
I also added C:\Program Files (x86)\Java\jre1.8.0_91\bin\client to my PATH variable in my Environment variables and restarted RStudio and tried to install and load rJava again. That also didn't work.
I would really appreciate if someone could please help me resolve this issue.
Thanks guys!
This worked for me -
This error is often resolved by installing a Java version (i.e. 64-bit Java or 32-bit Java) that fits to the type of R version that you are using (i.e. 64-bit R or 32-bit R). This problem can easily effect Windows 7 users, since they might have installed a version of Java that is different than the version of R they are using.
Note that it is necessary to ‘manually download and install’ the 64 bit version of JAVA. By default, the download page gives a 32 bit version .
You can pick the exact version of Java you wish to install from this link. If you might (for some reason) work on both versions of R, you can install both version of Java (Installing the “Java Runtime Environment” is probably good enough for your needs).
(Source: Uwe Ligges)
Other possible solutions is trying to re-install rJava.
If that doesn’t work, you could also manually set the directory of your Java location by setting it before loading the library:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre7') # for 64-bit version
Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre7') # for 32-bit version
library(rJava)
Refer this link - http://www.r-bloggers.com/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/
I encountered the same problem. Be sure to check the file path for Java. To solve the error I needed to download 64bit Java version. However the following code in R did not work as the folder was incorrect for the latest version for Java:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre7') # for 64-bit version
Instead I changed the name to:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_144')
Hope that helps
I have noticed in different fresh installations of R, RStudio and rJava in WIndows, that what fixes the error is:
Uninstall R
Reinstall R but only selecting one architecture. Example, x64, or x86, but not both. That tends to confuse R or RStudio when they are compiling.
In my case, I fixed the message
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/ankitagarwal5/Documents/R/win-library/3.2/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Following steps 1 and 2 above.
I tried what the other have said to not avail. For me the solution was to eliminate the old folders and shortcuts of R version 32 bit on my computer that remained there even after uninstalling.
This happened to me when Java was updated to a 32-bit, but R required a 64-bit version.
The solution:
Simply download the 64-bit version of Java
install it.
Restart RStudio
Everything should work
Where to download 64-bit java:
I guess your OS architecture and R architecture are not matching. If they are matching, the following might be the problem
It worked for me after i added the R library path to the environment variables list on my windows 7.
So,
Add 'C:/Users/Rohan-PC/Documents/R/win-library/3.1' this path to the Path variables list under System variables list(not to be confused with the PATH variable under User variables). Restart R and try loading the library. It works!!!!!
If you have both 64-bit R and 32-bit R versions installed, try from each one.
For me it worked on R 64bits but not R 32bits.
But of course that depends on your java version (64-bit Java vs 32-bit Java).

Unable to load Rcpp package

Due to my company's firewall I am manually installing packages from local. No errors when building the package from terminal, but I get an error when I load the package using library function
unable to load shared object 'C:/Program Files/R/R-3.6.1/library/Rcpp/libs/x64/Rcpp.dll':
LoadLibrary failure: The specified procedure could not be found.
And it also throws a prompt
Any help is appreciated thanks!
Tried:
Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object
https://github.com/r-lib/rlang/issues/306
None of the above seemed to work
I had this issue. I was using R 4.0.0 in RStudio (1.2.5042). I had been using R just fine all morning and continually had this issue all afternoon. I restarted my computer, updated my packages, and confirmed everything worked well on another computer. Finally I updated to R 4.0.2 and my issue resolved.
My binary package was correctly pathed to 4.0/Rcpp. I still don't know what caused the issue, but since this seemed to fix it hope it will for any future folk with this issue!
There has been a significant change in the build tools used for binary R packages on Windows:
Starting with R 4.0.0 (released April 2020), R for Windows uses a brand new toolchain bundle called rtools40.
https://cran.r-project.org/bin/windows/Rtools/
This means one has to be extra careful to get the correct file when downloading binary packages from CRAN, since packages for build with incompatible build tools will not work. At the time of writing this means:
Use the ones for r-oldrel for R 3.6
Use the ones for r-release for R 4.0
When this question was asked, R 4.0 was still r-devel.
You do not have to think about this things when using the build in install.packages() instead of manually downloading files from CRAN.

RStudio Install Packages and Package Updates both download then fail with cannot open file

Running happily with R 3.4 and RStudio 1.0.143 under Win10 this problem occured bringing project development to a halt. Downloads each occur and are unzipped and then the a presumably first file in the first item gets:
Error in install.packages : cannot open file 'C:/Users/Admin/Documents/R/
win-library/3.4/file30504386b80/rJava/javadoc/resources/background.gif':
Permission denied
and the prompt returns.
Updating to R version 3.4.1 (2017-06-30), RStudio Version 1.0.153 was to no avail. Using the OS to remolve all R versions and trying again with 3.4.1 did not work. Removing R again and deleting the R directory to refresh the library did not work. My virius software like to tell how helpful it has been and has not, so that issue seems unlikely.
Giving the user full control of the R library did not help.
could package-updates be a tag like install-updates?
It looks there is a problem between Java and rJava.
You should try reinstalling Java using chocolatey package manager (https://chocolatey.org/) and then reinstall rJava package.
I had a similar issue two weeks ago on a windows laptop.
I had this problem for a long time. only in RStudio.
Install the package on R and Library it. Go to RStudio and require the package.
It works!

R - Error : .onLoad failed in loadNamespace() for 'rJava'

While loading rJava package, I receive this error:
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/ankitagarwal5/Documents/R/win-library/3.2/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
In addition: Warning message:
package ‘rJava’ was built under R version 3.2.3
Error: package or namespace load failed for ‘rJava’
I referred various posts on StackOverflow and tried to make changes accordingly, but nothing worked. These are the various steps I followed to resolve the issue:
if (Sys.getenv("JAVA_HOME")!="")
Sys.setenv(JAVA_HOME="")
library(rJava)
This didn't work.
Then I tried this:
options(java.home="C:\\Program Files\\Java\\jre1.8.0_91\\")
library(rJava)
This didn't work either.
My jvm.dll is at this location in my Windows 7 64 bit OS - C:\Program Files (x86)\Java\jre1.8.0_91\bin\client
I also added C:\Program Files (x86)\Java\jre1.8.0_91\bin\client to my PATH variable in my Environment variables and restarted RStudio and tried to install and load rJava again. That also didn't work.
I would really appreciate if someone could please help me resolve this issue.
Thanks guys!
This worked for me -
This error is often resolved by installing a Java version (i.e. 64-bit Java or 32-bit Java) that fits to the type of R version that you are using (i.e. 64-bit R or 32-bit R). This problem can easily effect Windows 7 users, since they might have installed a version of Java that is different than the version of R they are using.
Note that it is necessary to ‘manually download and install’ the 64 bit version of JAVA. By default, the download page gives a 32 bit version .
You can pick the exact version of Java you wish to install from this link. If you might (for some reason) work on both versions of R, you can install both version of Java (Installing the “Java Runtime Environment” is probably good enough for your needs).
(Source: Uwe Ligges)
Other possible solutions is trying to re-install rJava.
If that doesn’t work, you could also manually set the directory of your Java location by setting it before loading the library:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre7') # for 64-bit version
Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre7') # for 32-bit version
library(rJava)
Refer this link - http://www.r-bloggers.com/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/
I encountered the same problem. Be sure to check the file path for Java. To solve the error I needed to download 64bit Java version. However the following code in R did not work as the folder was incorrect for the latest version for Java:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre7') # for 64-bit version
Instead I changed the name to:
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_144')
Hope that helps
I have noticed in different fresh installations of R, RStudio and rJava in WIndows, that what fixes the error is:
Uninstall R
Reinstall R but only selecting one architecture. Example, x64, or x86, but not both. That tends to confuse R or RStudio when they are compiling.
In my case, I fixed the message
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/ankitagarwal5/Documents/R/win-library/3.2/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Following steps 1 and 2 above.
I tried what the other have said to not avail. For me the solution was to eliminate the old folders and shortcuts of R version 32 bit on my computer that remained there even after uninstalling.
This happened to me when Java was updated to a 32-bit, but R required a 64-bit version.
The solution:
Simply download the 64-bit version of Java
install it.
Restart RStudio
Everything should work
Where to download 64-bit java:
I guess your OS architecture and R architecture are not matching. If they are matching, the following might be the problem
It worked for me after i added the R library path to the environment variables list on my windows 7.
So,
Add 'C:/Users/Rohan-PC/Documents/R/win-library/3.1' this path to the Path variables list under System variables list(not to be confused with the PATH variable under User variables). Restart R and try loading the library. It works!!!!!
If you have both 64-bit R and 32-bit R versions installed, try from each one.
For me it worked on R 64bits but not R 32bits.
But of course that depends on your java version (64-bit Java vs 32-bit Java).

Resources