0

I'm using install.packages('rJava', type='source')to install rJava, but it presents with the following error:

configure: error: one or more Java tools are missing.

*** JDK is incomplete! Please make sure you have a complete JDK. JRE is not sufficient. configure: error: ./configure failed for jri ERROR: configuration failed for package ‘rJava’ * removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’ * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’

Warning in install.packages : installation of package ‘rJava’ had non-zero exit status

I just installed JDK8 so I'm not sure what's going on. javac -version throws javac 1.8.0_231

java -version throws java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

This guy at R: rJava package install failing came up with a solution that I don't even understand since I'm new to this, but it has something to do with PATH and JAVA_HOMEand /jre apparently.

  • What is the output to `which java` and `echo $PATH` and `echo $JAVA_HOME`? Also, what is your platform? It looks like OS X, but it's best if you confirm. – Justin Guerin Dec 10 '19 at 21:07
  • @JustinGuerin Yes, it's OS X Mojave version 10.14, sorry. Output to `which java` is /usr/bin/java. Output to `echo $PATH` is /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usrlib/jvm/java-8-sun/jre/bin. Output to `echo $JAVA_HOME` is /usrlib/jvm/java-8-sun/jre – elzorroman Dec 10 '19 at 22:17
  • 1
    Looks like JAVA_HOME points to a JRE, not the JDK you want and need. Have a look at the [top voted answer](https://stackoverflow.com/a/1348940/12357638) to "What should I set JAVA_HOME to on OS X". Also see https://developer.apple.com/library/archive/qa/qa1170/_index.html. – Justin Guerin Dec 10 '19 at 22:27
  • @JustinGuerin Thank you for your help, it seems to have solved the issue with Java, but now I'm getting the following error: clang: error: unsupported option '-fopenmp' make[2]: *** [libjri.jnilib] Error 1 make[1]: *** [src/JRI.jar] Error 2 make: *** [jri] Error 2 ERROR: compilation failed for package 'rJava' * removing '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava' * restoring previous '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava' – elzorroman Dec 11 '19 at 00:45
  • Have a look at how this person solved that error. https://github.com/microsoft/LightGBM/issues/3 or https://stackoverflow.com/questions/43555410/enable-openmp-support-in-clang-in-mac-os-x-sierra-mojave. I recommend Googling the error message in situations like this. – Justin Guerin Dec 11 '19 at 15:07
  • 1
    Also, please update your question to include the output to `which java`, `echo $PATH` and `echo $JAVA_HOME`, and I'll put an answer below so that people who encounter the same problem in the future can find the solution more easily. – Justin Guerin Dec 11 '19 at 15:10

1 Answers1

1

Looks like JAVA_HOME points to a JRE, not the JDK you want and need. Have a look at the top voted answer to "What should I set JAVA_HOME to on OS X". Also see https://developer.apple.com/library/archive/qa/qa1170/_index.html