2

I am trying to install the GetDFPData package, but this error is appeared:

checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : ''
java libs   : ''
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.

ERROR: configuration failed for package ‘rJava’
* removing ‘/home/rtheodoro/R/x86_64-pc-linux-gnu-library/3.6/rJava’

I checked lots of answers, but didn't solve yet.

I am using Linux Mint 19.2 cinnamon.

When I run sudo R CMD javareconf, I have:

*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version     : 1.8.0_221
Java home path   : /usr/lib/jvm/java-ibm-x86_64-80/jre
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar

trying to compile and link a JNI program 
detected JNI cpp flags    : 
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/compressedrefs -ljvm
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
conftest.c:1:10: fatal error: jni.h: Arquivo ou diretório inexistente
 #include <jni.h>
          ^~~~~~~
compilation terminated.
/usr/lib/R/etc/Makeconf:167: recipe for target 'conftest.o' failed
make: *** [conftest.o] Error 1
Unable to compile a JNI program


JAVA_HOME        : /usr/lib/jvm/java-ibm-x86_64-80/jre
Java library path: 
JNI cpp flags    : 
JNI linker flags : 
Updating Java configuration in /usr/lib/R
Done.
$ javac -version
javac 1.8.0_222

At /usr/lib/jvm, I have four folders: ibm-java80-jre-x86_64 , java-1.8.0-openjdk-amd64 , java-8-openjdk-amd64 , java-ibm-x86_64-80 . I don't know why.

Can someone help me?

jww
  • 97,681
  • 90
  • 411
  • 885
RxT
  • 486
  • 7
  • 17
  • 1
    It's unclear whether or not you have JDK installed (which is an R dependency). Pull up a console and try `javac -version` and let us know the response. Note: I'm not asking for `java -version` -- I want to see the compiler version. – MarsAtomic Dec 05 '19 at 02:30
  • Yes, I have: javac 1.8.0_222 – RxT Dec 05 '19 at 02:34

1 Answers1

1

I solved it. I tried the "Please don't laugh at me" answer's at R CMD javareconf not finding jni.h

so I did:

(1) Updating all repositories sudo apt update -y (2) Being sure JRE and JDK 8 are installed sudo apt install -y openjdk-8-jdk openjdk-8-jre (3) Then, as many users have said already, pointing R to java with an explicit path to JDK 8 sudo R CMD javareconf JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/

RxT
  • 486
  • 7
  • 17
  • 1
    Yeah. You noticed there's a mismatch in versions between what javareconf reports and what your `javac -version` reports? Something strange happened with your Java installation, and somehow, header files were not written to your `include` directory. – MarsAtomic Dec 05 '19 at 02:52