Error 127 Unable to compile a JNI program on mac

I want to install rJava in my Rstudio but it doesn’t work. When I am typing R CMD javareconf in the console I get the following error:

trying to compile and link a JNI program 
detected JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
/usr/local/Cellar/gcc/9.2.0_2/bin/gcc-7 -I"/Library/Frameworks/R.framework/Resources/include"-DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/include/darwin  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c conftest.c -o conftest.o
/bin/sh: /usr/local/Cellar/gcc/9.2.0_2/bin/gcc-7: No such file or directory
make: *** [conftest.o] Error 127
Unable to compile a JNI program

JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
Java library path: 
JNI cpp flags    : 
JNI linker flags : 
Updating Java configuration in /Library/Frameworks/R.framework/Resources

I know there are a lot of similar questions related to this in stackoverflow, such as this. and I have looked through all of the solutions, but still didn’t work. I have been spending hours trying to figure this out but still stuck here.
(I have successfully download JDK, my java version is 13.0.1.
And I have set JAVA_HOME)

Can anyone please help me with this question? Thank you so much.

Archive from:

Leave a Reply

Your email address will not be published. Required fields are marked *