0

Problem when trying to run Java in R:

JavaVM: requested Java version ((null)) not available. Using Java at "" instead. JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib JavaVM FATAL: Failed to load the jvm library.

I saw postings here about these issues, but none of the suggested fixes helped.

I'm on Mac OS 10.13.

My JAVA_HOME is: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

java -version java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

I'm using R: 3.3.3

Here is sample code that throws this error:

library(rJava)
.jinit() # this starts the JVM
s <- .jnew("java/lang/String", "Hello World!")

(this is the "hello world" equivalent from the rJava site)


I also tried to use Java 7 (rev. 51), which used to work, but that still fails.

I suspect Java itself is working fine since JDBC code has no issues.

Not sure why loading Java in R stopped working, but would appreciate any suggestions.

Thanks,

Morkus
  • 517
  • 7
  • 21
  • https://stackoverflow.com/questions/27661325/unable-to-load-rjava-on-r – Tim Biegeleisen Oct 21 '17 at 11:25
  • It sounds then like R cannot find Java. Please check the above duplicate link. – Tim Biegeleisen Oct 21 '17 at 11:26
  • I also tried to install the latest JDK for Version 8 (152), but that didn't help. Issuing "install.packages("rJava"), which I had already tried, gives an "Error in install.packages :Updating loaded packages". Not a helpful error. Thanks for your reply. (rJava is already showing up in Packages) – Morkus Oct 21 '17 at 13:26
  • Did you even read the above link? You need to configure R to know about the JDK installation you have. – Tim Biegeleisen Oct 21 '17 at 13:38
  • Yes, did read it. It was all working fine a month ago, nothing's changed that I am aware of. I also ran the " R CMD javareconf" as root and it reports "conftest.c:1:10: fatal error: 'jni.h' file not found". I think I have a different problem, right? Thanks. Not that your link above wasn't good, but I'm also on Mac so some of the "DLL" issues don't apply. – Morkus Oct 21 '17 at 14:05
  • I finally gave up and re-installed Java (gulp) 6 on the Mac. **Re-installing Java 6 fixed it!** Apple always removed Java 6 every time you upgrade to a new OS version (like 10.12 -> 10.13) so that looks like what changed. Nothing I could do with Java 8 despite spending an entire head-banging day (15 cups of coffee) on it came close. No idea why R/Java has this now-archaic J6 dependency, but there you go. I hope this answer helps someone else. :) – Morkus Oct 22 '17 at 11:23

0 Answers0