Install R (and R-devel) on Linux CentOs using Java 1.8

linux

#1

I've been provided with a VM on Linux CentOs7 and using Java 1.8. Because we are using Java 1.8 I have struggles to install R properly. I am able to install R-base just not R-devel:

Error: Package: R-java-devel-3.5.1-1.el7.x86_64 (epel)
           Requires: java-devel
           Available: 1:java-1.7.0-openjdk-devel-1.7.0.171-2.6.13.2.el7.x86_64 (centos-base-prod)
               java-devel = 1:1.7.0
           Available: 1:java-1.7.0-openjdk-devel-1.7.0.181-2.6.14.5.el7.x86_64 (centos-updates-prod)
               java-devel = 1:1.7.0
           Available: 1:java-1.7.0-openjdk-devel-1.7.0.181-2.6.14.8.el7_5.x86_64 (centos-updates-prod)
               java-devel = 1:1.7.0
           Available: 1:java-1.7.0-openjdk-devel-1.7.0.191-2.6.15.4.el7_5.x86_64 (centos-updates-prod)
               java-devel = 1:1.7.0
           Available: 1:java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.i686 (centos-base-prod)
               java-devel = 1:1.8.0
           Available: 1:java-1.8.0-openjdk-devel-1.8.0.171-7.b10.el7.i686 (centos-updates-prod)
               java-devel = 1:1.8.0
           Available: 1:java-1.8.0-openjdk-devel-1.8.0.171-8.b10.el7_5.i686 (centos-updates-prod)
               java-devel = 1:1.8.0
           Available: 1:java-1.8.0-openjdk-devel-1.8.0.181-3.b13.el7_5.i686 (centos-updates-prod)
               java-devel = 1:1.8.0

I have found several posts relating to working with R on a different version of java in the context of OSX but none using Linux, in my case CentOs7.

Without R-devel I'm unable to install packages.

I found several posts suggesting I do:

sudo R CMD javareconf

Which resulted in this output:

[myname@myip ~]$ sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version     : 1.8.0_92
Java home path   : /usr/java/jdk1.8.0_92/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    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -I/usr/java/jdk1.8.0_92/jre/../include -I/usr/java/jdk1.8.0_92/jre/../include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c conftest.c -o conftest.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o conftest.so conftest.o -L/usr/java/jdk1.8.0_92/jre/lib/amd64/server -ljvm -L/usr/lib64/R/lib -lR


JAVA_HOME        : /usr/java/jdk1.8.0_92/jre
Java library path: $(JAVA_HOME)/lib/amd64/server
JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
Updating Java configuration in /usr/lib64/R
Done.

However, I still fail to install R-devel after running that snippet.

I've found posts suggesting I change JAVA_HOME but then others warning me not to play around with that, example this one: https://stackoverflow.com/questions/26948777/how-can-i-make-rjava-use-the-newer-version-of-java-on-osx.

What's the prescribed approach here? I've asked my Sys admins if we can use Java 1.7 but they are unable to change it.