Search code examples
javarrjava

ERROR: configuration failed for package 'rJava'


Tried installing rJava on R but getting this error

install.packages("https://cran.r-project.org/src/contrib/Archive/rJava/rJava_0.9-9.tar.gz", repos = NULL, type="source")

Warning: running command 'sh ./configure.win' had status 127 ERROR: configuration failed for package 'rJava'

Installed jdk-18.0.1.1 and also set environment variables like this

JAVA_HOME: C:\Users\H481821\Downloads\openjdk-18.0.1.1_windows-x64_bin


Solution

  • I changed environment path from

    JAVA_HOME: C:\Users\H481821\Downloads\openjdk-18.0.1.1_windows-x64_bin
    to
    C:\Users\H481821\Downloads\openjdk-18.0.1.1_windows-x64_bin\jdk-18.0.1.1
    

    and executed R cmd

    install.packages("rJava", type="win.binary")
    

    (Use this to get compatible package to you R version so that you won't face version issues)