Possible mailR/rJava Filepath Issue? - java

In the past, I have used the mailR package with no issues on both Mac and Windows. Ever since the last R/RStudio update, mailR and rJava will no longer work. I can install both packages just fine. But, I cannot load them with the library() command. When I try, I get the following errors:
> library(mailR)
>Error: package or namespace load failed for ‘mailR’: .onLoad failed in
loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/Users/rotendd/Library/R/3.4/library/rJava/libs/rJava.so':
dlopen(/Users/rotendd/Library/R/3.4/library/rJava/libs/rJava.so, 6): Library
not loaded: #rpath/libjvm.dylib
Referenced from: /Users/rotendd/Library/R/3.4/library/rJava/libs/rJava.so
Reason: no suitable image found. Did find:
/Library/Frameworks/R.framework/Resources/lib/libjvm.dylib: mach-o, but
wrong architecture
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libclient.dyl
ib: mach-o, but wrong architecture
and
> library(rJava)
>Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/Users/rotendd/Library/R/3.4/library/rJava/libs/rJava.so':
dlopen(/Users/rotendd/Library/R/3.4/library/rJava/libs/rJava.so, 6): Library
not loaded: #rpath/libjvm.dylib
Referenced from: /Users/rotendd/Library/R/3.4/library/rJava/libs/rJava.so
Reason: no suitable image found. Did find:
/Library/Frameworks/R.framework/Resources/lib/libjvm.dylib: mach-o, but
wrong architecture
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libclient.dyl
ib: mach-o, but wrong architecture
From what I have found just Googling around, it seems that I need to manually change a file path in one of the functions. I think I can find my way around the Java folders to get what I need but I'm not sure how to manually change a file path in a package like this.
I think I have all the pieces to fix this problem, I just need a little guidance on orchestrating my solution. Thanks!

Related

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 rjava in macbook pro 64-bit

I am trying to run the JDBC package. however, that requires that I install the rjava package. when i install rjava library, i get the following error:
library(rJava)
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.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/rJava/libs/rJava.so
Reason: image not found
In addition: Warning message:
In system("/usr/libexec/java_home", intern = TRUE) :
running command '/usr/libexec/java_home' had status 1

Java issue with Rsentiment package

I'm working on sentiment analysis. I'm trying to use Rsentiment package in order to get the score for each sentence of my dataset. When I run the command I get a warning message related to an issue with Java. Does anyone of you have any suggestion? I run it on a Macbook. This is the message that I got:
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Errore: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
Inoltre: Warning message:
running command '/usr/libexec/java_home' had status 1

RStudio not working in Mac OS Sierra 10.12.4

Hi and thanks in advance,
Don't know why but I get the following error message when trying to load a csv file in my RStudio desktop version that I have installed in my MAC:
Error: package or namespace load failed for 'rJava':
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
Could you please help me? I have tried downloading the latest version of Java, but does not work.
Thanks!

Rjava 64-bit error

I am receiving this error when I use packages XLConnect and rJava.
Loading required package: XLConnectJars
Error : .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/R-3.2.2/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
I have not seen this specific error in any threads here on in this community. Though I do believe the issue to be related to some other threads.
I have downloaded 64-bit java, and have tried to fix the path to java with:
Sys.setenv(JAVA_HOME='C:\Program Files\\Java\\jre1.8.0_65\\bin\\client\\jvm.dll')

Categories