#StackBounty: #r #macos #rjdbc jni.h file not found

Bounty: 50

I’m ultimately trying to install the RJDBC package on a mac running R 3.3.3 and Java 12 and Mojave OS.

When trying to install RDJBC I get the following error:

configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

So then I go ahead and run R CMD javareconf in the terminal and I get the following error:

conftest.c:1:10: fatal error: 'jni.h' file not found

I’ve found various questions online around the same topic and have tried out suggested solutions and none have worked for me. Ity could be a combination of my OS/Java version. Would someone be willing to walk me through a fix here?

Update:

Stacktrace

WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if avaiable).
ERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.
Exception in thread "main" java.lang.NullPointerException
    at java.base/jdk.internal.reflect.Reflection.verifyMemberAccess(Reflection.java:130)
    at java.base/java.lang.reflect.AccessibleObject.slowVerifyAccess(AccessibleObject.java:673)
    at java.base/java.lang.reflect.AccessibleObject.verifyAccess(AccessibleObject.java:666)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:638)
    at java.base/java.lang.reflect.Field.checkAccess(Field.java:1075)
    at java.base/java.lang.reflect.Field.get(Field.java:416)
Error in .jcheck(silent = FALSE) : 
  java.lang.NullPointerException.jcall(f, "Ljava/lang/Object;", "get", .jcast(ic, "java/lang/Object"))new("jobjRef", jobj = <pointer: 0x7fd4a04ac4b8>, jclass = "java/lang/NullPointerException")

Interestingly, it seems to work when I run R through terminal, but not in Rstudio.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.