A memo because the contents were unexpectedly lost
See official for a description of the Java / R Interface itself https://www.rforge.net/JRI/
Just install Java as usual and put it in the PATH, so omit it.
Yum is probably OK, but I wanted to include an older version so I made it myself.
wget https://cran.r-project.org/src/base/R-3/R-3.2.0.tar.gz
tar zxvf R-3.2.0.tar.gz
cd R-3.2.0
./configure --with-x=no && make && sudo make install
Include rJava package
sudo R CMD javareconf ##Automatically set Java environment information in R
sudo R ##R interactive shell launches
[R console] > install.packages('rJava') ##You will be asked if you want to install locally, so yes
[R console] > system.file("jri",package="rJava") ## (1)rJava location
Set environment variables
R RHOME ## (2)R location. The result is different from which R, but this is correct.
vi ~/.bash_profile
## bash_Appropriately added to profile
LD_LIBRARY_PATH=/usr/lib64/R/library/rJava/jri/:/usr/local/lib64/R/lib/ ## (1)
export LD_LIBRARY_PATH
R_HOME=/usr/local/lib64/R ## (2)
export R_HOME
source ~/.bash_profile
If you start the server the way you like, Java should recognize R correctly.
Recommended Posts