If you are installing rJava in R and you encountered this issue during install
% R
> install.packages("rJava")
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : ''
compiler : ''
header prep.: ''
cpp flags : ''
java libs : ''
configure: error: Java Development Kit (JDK) is missing or not registered in R
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/R-4.1.0/lib64/R/library/rJava’
The downloaded source packages are in
‘/tmp/RtmpnllvN9/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("rJava") :
installation of package ‘rJava’ had non-zero exit status
> install.packages("javareconf")
Warning message:
package ‘javareconf’ is not available for this version of R
The Issue is to fix the missing Java Support to R. You can download the Java version you required https://www.oracle.com/java/technologies/downloads/archive/ I chose version 11. I used the “Linux x64 Compressed Archive”. Installation was a breeze as it is just unpacking and java can be used immediately. But it is important to make sure the environment is fixed. For example,
export JAVA_HOME=/usr/local/jdk-11.0.12
export PATH=$PATH:/usr/local/jdk-11.0.12/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/jdk-11.0.12/lib
export MANPATH=$MANPATH:/usr/local/jdk-11.0.12/share
Now you can run R. At the command prompt, type install.packages(“rJava”)
% R
> install.packages("rJava")
> library("rJava")
References: