rJAVA wrong java version
<p>This problem has plagued me for a week now. I have installed rJAVA from R running on a Ubuntu server 14.04. I installed rJava package as source like this: </p>

<pre><code>install.packages("rJava", type="source")
</code></pre>

<p>and I get:</p>

<pre><code>DONE(rJava)
</code></pre>

<p>I have installed <code>java-8-openjdk</code> and when running <code>java -version</code> I get the correct version and this is the output:</p>

<pre><code>openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~14.04-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
</code></pre>

<p>However when I check the java version in R using either </p>

<pre><code>sudo R CMD javareconf 
</code></pre>

<p>or </p>

<pre><code>library(rJava)
jinit()
.jcall("java/lang/System", "S", "getProperty", "java.runtime.version") 
</code></pre>

<p>The java version is still set to 1.7:</p>

<pre><code>Java interpreter : /usr/lib/jvm/default-java/jre/bin/java
Java version     : 1.7.0_101
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
detected JNI linker flags : -L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/default-java/include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR


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

<p>Please let me know what I'm missing.</p>