[問題類型]:
經驗諮詢(我想用R 連接某些資料庫,請問大家的經驗)
[軟體熟悉度]:
請把以下不需要的部份刪除
新手(沒寫過程式,R 是我的第一次)
[問題敘述]:
我目前想要用xlsx去讀一些檔案,所以安裝rjava
但是現在卻只能在 sudo root下面才能跑。
但我記得我在上一台電腦時不用
想問一下是我哪裡設定有問題
補上錯誤訊息(如果用sudo 開啟rstudio則不會有此錯誤)
library("rJava", lib.loc="/usr/lib/R/site-library")
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: 無法載入共享物件 '/usr/lib/R/site-library/rJava/libs/rJava.so' :
libjvm.so: 無法開啟共用目的檔: 沒有此一檔案或目錄
錯誤: package or namespace load failed for ‘rJava’
$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
$ sudo R CMD javareconf
Java interpreter : /usr/lib/jvm/java-7-oracle/jre/bin/java
Java version : 1.7.0_80
Java home path : /usr/lib/jvm/java-7-oracle
Java compiler : /usr/lib/jvm/java-7-oracle/bin/javac
Java headers gen.: /usr/lib/jvm/java-7-oracle/bin/javah
Java archive tool: /usr/lib/jvm/java-7-oracle/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/java-7-oracle/include -I/usr/lib/jvm/java-7-oracle/include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-7-oracle/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR
JAVA_HOME : /usr/lib/jvm/java-7-oracle
Java library path: $(JAVA_HOME)/jre/lib/amd64/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
Updating Java configuration in /usr/lib/R
Done.
[環境敘述]:
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
[關鍵字]:
rJava安裝