[R-sig-Debian] So nearly there, but can't install rJava

Johannes Ranke joh@nne@@r@nke @end|ng |rom jrwb@de
Tue Jan 22 15:18:56 CET 2019


Hi Chris,

> I think the problem may be options setting where R/rJava will look for Java 
so I tried:
> > options(java.home="/usr/lib/jvm/java-8-openjdk-amd64/")

This should not be necessary. I would recommend to start a fresh R session in 
order to unset this.

> As far as I can see Debian is happy with the setup of java and javac:
> 
...

> And I have the full jdk not just the headless version I can see the header
> files:
> 
...

> But I can't reconfigure R for Java:
> 
> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# R CMD javareconf
> *** JAVA_HOME is not a valid path, ignoring

as above, I would not recommend setting JAVA_HOME manually.

> Java interpreter : /usr/lib/jvm/default-java/jre/bin/java
> /usr/lib/R/bin/javareconf: 1: /usr/lib/R/bin/javareconf:
> /usr/lib/jvm/default-java/jre/bin/java: not found

Obviously this file was not found. Again, apt-file can provide some help (but 
not when giving it the full path, because of the link maintained by update-
alternatives:

  apt-file search jre/bin/java

If you have openjdk-8-jre-headless installed, this file should be there on your 
system. Seems you don't have the jre installed?

...

> Tangential question: surely I'm not rare in running R 3.5.2 on Stretch am I?

I for sure am running it without issues on several computers. On my desktop, I 
am using openjdk-9 from stretch-backports, but on my laptop I just upgraded 
from R 3.4.x to R 3.5.2 using the stretch-cran35 packages on CRAN, and had no 
issues. I could install rJava from within R, and after that R CMD javareconf 
gives me:

Java interpreter : /usr/lib/jvm/default-java/jre/bin/java
Java version     : 1.8.0_181
Java home path   : /usr/lib/jvm/default-java
Java compiler    : /usr/lib/jvm/default-java/bin/javac
Java headers gen.: /usr/lib/jvm/default-java/bin/javah
Java archive tool: /usr/lib/jvm/default-java/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)/jre/lib/amd64/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/default-java/
include -I/usr/lib/jvm/default-java/include/linux     -fpic  -g -O2 -fdebug-
prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.4.3=. -fstack-
protector-strong -Wformat -Werror=format-security -Wdate-time -
D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o conftest.so conftest.o 
-L/usr/lib/jvm/default-java/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR


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

> Other tangential question: is there anything that can be done to fix the
> r-api-3/r-api-3.5 issue.  You can see I'm no programmer or sysadmin but if
> there is anything I can do to help ...?

Thanks for the offer. Personally, I am always glad to get some feedback from 
people using the Debian backports on CRAN, so thanks for that. On the other 
hand, I do not think that there is an error to be fixed. Of course it would be 
nice if we could provide more precompiled debs for these backports in order to 
avoid having to install them from sources. For me personally, this is not a 
priority, I am happy if I manage to get the base and recommended packages out 
on new releases.

Johannes

> 
> TIA all,
> 
> Chris
> 
> 
> 
> ----- Original Message -----
> 
> > From: "Dirk Eddelbuettel" <edd using debian.org>
> > To: "Chris Evans" <chrishold using psyctc.org>
> > Cc: "r-sig-debian" <r-sig-debian using r-project.org>
> > Sent: Tuesday, 22 January, 2019 12:21:39
> > Subject: Re: [R-sig-Debian] So nearly there, but can't install rJava
> > 
> > On 22 January 2019 at 10:14, Chris Evans wrote:
> >| root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# apt-get install
> >| openjdk-8-jdk-headless
> >| Reading package lists... Done
> >| Building dependency tree
> >| Reading state information... Done
> >| openjdk-8-jdk-headless is already the newest version
> >| (8u181-b13-2~deb9u1).
> >| openjdk-8-jdk-headless set to manually installed.
> >| 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> >| 
> >| Anyone else got any ideas?
> > 
> > Install the full-blown jdk no just headless.
> > 
> > In the sources for rJava I have as a build-depends
> > 
> >   openjdk-10-jdk
> > 
> > which may of course be a virtual. At some point we had more than JDK
> > implementation.  See what you can find there.
> > 
> > Dirk
> > 
> > --
> > http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org


-- 
Johannes Ranke
Wissenschaftlicher Berater
https://jrwb.de/contact



More information about the R-SIG-Debian mailing list