简体   繁体   中英

Problems with JAVA in Linux Mint

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?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM