Why does not rsubgroup initialize Java? - java

I am working with R 4.2.1, 64bit, Windows 10.
while calling library rsubgroup, I get an error:
library(rsubgroup)
Loading required package: foreign
Error: package or namespace load failed for ‘rsubgroup’:
.onLoad failed in loadNamespace() for 'rsubgroup', details:
call: .jinit(parameters = parameters)
error: Unable to create a Java class loader.
rJava loads without problems.
I have installed Java 1.8.0_341 and JDK jdk-18.0.2
I have set-up manually JAVA_HOME and PATH variables.
Any hints what can go wrong with .jinit?
many thanks!
Solved, caused by my comp installation: R is installed in C:.../ProgramFiles that is write-protected (accessible only by "admin"); rJava and rsubgroup installed in the ...Users personal library. While moving all installation (core R, libraries) to writable disk, all starts to work. Apologies for this dumb question but I leave it here - perhaps could help somebody in future...

Related

When I upgrade MatlabRuntime from 2019b to 2021b,I hava a proplem

When I upgrade MatlabRuntime from 2019b to 2021b and I hava a springboot service used matlab, I have a problem,I import newest javabulider.jar(2021b) into my springboot service, then I package and publish my service into server,then report an error,can someone help me,thank you
Caused by: java.lang.UnsatisfiedLinkError: Failed to find the required library libmwmclmcrrt.so.9.7 on java.library.path.
This library is typically installed along with MATLAB or the MATLAB Runtime. Its absence may indicate an issue with that installation or
the current path configuration, or a mismatch with the architecture of the Java interpreter on the path.
MATLAB Runtime version this component is attempting to use: 9.7.
Java interpreter architecture: glnxa64.
I need someone can help me
The message:
Failed to find the required library libmwmclmcrrt.so.9.7
Indicates that the application you are trying to execute was compiled with Matlab 2019b and that the corresponding MCR is not installed.

Problems with installing rJava package

I have tried to call the library xlsx, since I want to save data in multiple-sheets excel files, but I got a Java-related error. Even when I run library(rJava) I have this error code:
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/me/Documents/R/win-library/4.0/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found.
The solutions I have found online are quite old and none helped to solve the issue: I have tried to reinstall Java 64 bit on my OS (Windows 10-64bit), and the package rJava, I have tried to set Java home with Sys.setenv(JAVA_HOME="C:\Program Files\Java\jre1.8.0_271\") without success. I use R 64 bit.
Do you have any suggestions?
Finally, the solution reported here worked for me. The most important thing is to download the offline version of Java

Unable to install R JavaGD package on OSX

I have tried to install the R package JavaGDon MacOS 10.14.6. My R version is 3.6.1. When I do instal.packages there is apparently no error, but when I do in R console:
library(JavaGD)
Error: package or namespace load failed for ‘JavaGD’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/JavaGD/libs/JavaGD.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/JavaGD/libs/JavaGD.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/JavaGD/libs/JavaGD.so
Reason: image not found
It should work fine in macOS 10.14.
However, make sure your R and Java environments are correctly configured.
It might be a little bit of struggle to properly configure Java in R.
I suggest to start with simple Java code:
http://www.owsiak.org/r-java-11-and-making-sure-you-can-load-rjava/
to make sure you can actually use Java inside R.
In some cases it might be required to rebuild rJava package.
http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/
Anyway, I guess that first step is to make sure you can actually bind these two worlds.

library(rJava) does not load after installing package

I have been reading up on examples and cannot figure out the solution. I also had IT come by and they can't figure out why it isn't working also.
I am trying to use the 'rJava' package from R.
I uninstalled RStudio and R to get the latest versions.
Here is what I did:
install.packages('rJava')
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/rJava_0.9-9.zip'
Content type 'application/zip' length 720033 bytes (703 KB)
downloaded 703 KB
package ‘rJava’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Temp\RtmpSyCpeu\downloaded_packages
Then when I run below, this is what shows up:
library(rJava)
This same error message happens after I uninstalled RStudio and R.
When I click ok, below is the error that comes up.
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/nicknaue/Documents/R/R-
3.4.3/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found.
To try and solve for this, we downloaded the latest Java and also got a file from another program with the same name: jvm.dll and put it in the same file path. No luck also.
Has anyone come across this issue before?
Also, something weird, I have another computer where I tried this on and no errors came up.
I know there have been posts on this but I feel like I have tried everything at this point.
Figured out the answer from this link: Unable to load rJava on R
The issue was that I had 64-bit R and 32 bit Java. The two were not compatible before. You need 64 bit Java in order to run rJava if you have 64 bit R.

JCuda error: undefined symbol: Pointer_buffer

I am trying to run a JCuda example in Debian Linux (32bit). Since there is no binaries available on JCuda website for Linux x86, I've compliled the libraries. Now I'm trying yo run the DeviceQuery example but I get the following errors:
Error while loading native library "JCudaDriver-linux-x86" with base name "JCudaDriver"
Operating system name: Linux
Architecture : i386
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name '/lib/libJCudaDriver-linux-x86.so'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:144)
at jcuda.LibUtils.loadLibrary(LibUtils.java:80)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
at jcudatest.JCudaTest.main(JCudaTest.java:29)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: undefined symbol: Pointer_buffer
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at jcuda.LibUtils.loadLibrary(LibUtils.java:90)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
at jcudatest.JCudaTest.main(JCudaTest.java:29)
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:122)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
at jcudatest.JCudaTest.main(JCudaTest.java:29)
Java Result: 1
I belive the error here is related to that undefined symbol Pointer_buffer, since I created symbolic links on /lib and this folder is on PATH variables (I can see it resolving the symboling link to /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so like it was supposed). Everything is working with Cuda as well, since I can compile and run Cuda examples. Cuda version is 4.0.17 and JCuda 0.4.0-beta1 (from JCuda website I can see Version 0.4.0-beta1. These libraries have been compiled for CUDA 4.0 (build 17) so I think I don't have any incompatibility here as well).
I am setting up my project on Netbeans, and I've included the source files present on JcudaJava folder. Do I need to include the cpp and hpp file from JCudaDriverJNI and JCudaRuntimeJNI folders (I never worked with JNI before, don't really know what I need to include).
Thanks in advance,
Rui
An "undefined symbol" means that a definition for the symbol (variable, function) was not found. JCuda defines Pointer_buffer in CommonJNI/PointerUtils.cpp so there must have been some problem including PointerUtils.o in the .so. Were there any errors when you compiled?

Categories