0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Rのxlsx, rJavaパッケージがインストールできないときの対処法

Last updated at Posted at 2021-01-18

Rでxlsxファイルを読み込むためのパッケージの1つである、
xlsxパッケージをインストールしようとしたら以下のようなエラーが出た。

checking whether JNI programs run... configure: error: Unable to run a simple JNI program. Make sure you have configured R with Java support (see R documentation) and check config.log for failure reason.
 system(cmd) で警告がありました:   命令の実行中にエラーが起きました 
ERROR: configuration failed for package rJava

 警告メッセージ: 
1:  install.packages("xlsx") : 
   パッケージ rJava のインストールはゼロでない終了値をもちました 

対処法はココを参考にした。

環境

  • CentOS Linux 7.9
  • R 3.6.0

解決方法

JAVAで使用している変数を設定する。

R CMD javareconf -e
The following Java variables have been exported:
JAVA_HOME JAVA JAVAC JAVAH JAR JAVA_LIBS JAVA_CPPFLAGS JAVA_LD_LIBRARY_PATH

ここで設定されているJAVA_LIBSに問題があるようなので、以下のコマンドを打って修正。
export JAVA_LIBS="$JAVA_LIBS -ldl"

JAVA変数を更新。許可がないと言われたらsudoつけて実行。
R CMD javareconf
Updating Java configuration in /usr/lib64/R
Done.

Rを起動してrJavaをインストール。 (rJavaからインストールしたが、直接xlsxをインストールしても大丈夫なはず。)
install.packages("rJava")

xlsxをインストール

install.packages("xlsx")
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?