R: rJava package install failing
Turns out my problem was an issue with my JAVA_HOME
environment variable. Yes, shocking I know. My initial setting for PATH
and JAVA_HOME
looked like this:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin
And I added /jre
so it now looks like this:
export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
export PATH=$PATH:$JAVA_HOME/bin
Everything in Java seemed to work fine without the /jre
but rJava would not. Odd.
configuration failed for package ‘rJava’ when running rize - R
It looks like you have issues with setting proper location of Java. Note that making R
happy with Java
might be a little bit of struggle.
Take a look here: http://www.owsiak.org/r-java-11-and-making-sure-you-can-load-rjava/ for a sample. It is macOS
based, but still, it should work fine.
Basically, what you want to do is to set your JAVA_HOME
such way it points at Java
installation. Once it's done, you can run R cmd javareconf
like this
> sudo R CMD javareconf \
JAVA_HOME=${JAVA_HOME} \
JAVA=${JAVA_HOME}/bin/java \
JAVAC=${JAVA_HOME}/bin/javac \
JAVAH=${JAVA_HOME}/bin/javah \
JAR=${JAVA_HOME}/bin/jar
Make sure you have gcc
installed and that you can compile simple C
code.
ERROR: configuration failed for package 'rJava'
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)
Related Topics
R: How to Check If All Columns in a Data.Frame Are the Same
How to Debug "Contrasts Can Be Applied Only to Factors With 2 or More Levels" Error
Join 3 Columns of Different Lengths in R
I Want to Split Street Address into Two Columns. One With Street Number Other With Street Name
How to Combine Multiple Variable Data to a Single Variable Data
R Markdown - Changing Font Size and Font Type in HTML Output
Removing Space Between Numeric Values in R
Choose the Top Five Values from Each Group in R
Aggregate/Summarize Multiple Variables Per Group (E.G. Sum, Mean)
Counting Unique Values Across Variables (Columns) in R
How to Generate a Histogram for Each Column of My Table
How to Prevent Ifelse() from Turning Date Objects into Numeric Objects
Reshaping Data.Frame from Wide to Long Format
How to Plot With 2 Different Y-Axes
Categorize Numeric Variable into Group/ Bins/ Breaks
How to Sort a Character Vector Where Elements Contain Letters and Numbers