3

I am trying to install the package rJava in R on Arch Linux.

I got the error:

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.

Running sudo R CMD javareconf, I can see that Java headers gen.: is not set, but I have failed to figure out how to set it.

Here is the full java configuration seen by R (beside Java haders gen., the rest looks ok to me):

Java interpreter : /usr/bin/java
Java version     : 10
Java home path   : /usr/lib/jvm/java-10-openjdk
Java compiler    : /usr/bin/javac
Java headers gen.: 
Java archive tool: /usr/bin/jar

I do have javah in /usr/bin. But how do I "tell" this to R?

7
  • Can you go to usr/bin and check whether javah is present?
    – Absent
    Apr 25, 2018 at 7:40
  • I have a symlink: javah -> /usr/lib/jvm/default/bin/javah
    – prosoitos
    Apr 25, 2018 at 7:47
  • Oh! Your comment pushed me to follow the symlink (and a 2nd symlink in the path) and to find out that there is no javah in /usr/lib/jvm/default/bin/. So I guess that's why R can't find it... When I was looking for javah with locate to make sure it existed, I was getting the symlink as a result. So I thought that it was fine and failed to see that it lead nowhere. Now... I am not sure where to find javah...
    – prosoitos
    Apr 25, 2018 at 8:06
  • (Thank you @IvoVidovic for pointing me to the right direction).
    – prosoitos
    Apr 25, 2018 at 8:13
  • Now... where do I find javah? This thread did not help me. And the only javah I seem to have on my machine is that symlink leading to a non existent file.
    – prosoitos
    Apr 25, 2018 at 8:38

1 Answer 1

2

Thanks to @IvoVidovic's comment, I went to /usr/bin and inspected javah. It turned out that it was a symlink to a non-existent file. In fact, javah is missing from Arch Linux OpenJDK 10 (the file is not listed in the package contents).

  • Installing OpenJDK 9,
  • updating my JAVA_HOME with export JAVA_HOME=/usr/lib/jvm/java-9-openjdk,
  • setting OpenJDK 9 as my default jdk with sudo archlinux-java set java-9-openjdk,
  • and re-running sudo R CMD javareconf allowed R to find all the java files, including javah.

I now have:

Java interpreter : /usr/bin/java
Java version     : 9.0.4
Java home path   : /usr/lib/jvm/java-9-openjdk
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar

and I could install rJava without any issue.

Thanks again to @IvoVidovic who sent me in the right direction with his comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.