Try this it worked for me get over the configuration problem
http://www.ibm.com/support/knowledgecenter/SSPT3X_3.0.0/com.ibm.swg.im.infosphere.biginsights.install.doc/doc/install_install_r.html
I struggled installing rJava and had few learning. Let me explain.
When you issue the install package command in R
install.packages("rJava")
Look for the following varaibles set in the R env.
checking Java support in R... present: interpreter :
'/usr/java/jdk1.8.0_111/jre/bin/java' archiver :
'/usr/java/jdk1.8.0_111/jre/../bin/jar' compiler :
'/usr/java/jdk1.8.0_111/jre/../bin/javac' header prep.:
'/usr/java/jdk1.8.0_111/jre/../bin/javah' cpp flags :
'-I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux' java
libs : '-L/usr/java/jdk1.8.0_111/jre/lib/amd64/server -ljvm -ldl'
My java was installed /usr/java/jdk1.8.0_111.
Verify if every path specified by variables is correct. Next look for you LD_LIBRARY_PATH. I think it looks for "libjvm.so" in this path. For me it was
export LD_LIBRARY_PATH=/usr/lib/jvm/jdk1.8.0_111/jre/lib/amd64/server:/usr/lib/jvm/jdk1.8.0_111/jre/lib/amd64/
set your JAVA_HOME env variable
First issue the command
R CMD javareconf -e
It will set the following variables
JAVA_HOME JAVA JAVAC JAVAH JAR JAVA_LIBS JAVA_CPPFLAGS JAVA_LD_LIBRARY_PATH
modify the JAVA_LIBS directory
export JAVA_LIBS="$JAVA_LIBS -ldl"
Again issue javareconf command without -e
R CMD javareconf
Now enter into R shell and issue the rJava install command and it should find all the env variables and it should work.