libjvm.so:无法打开共享对象文件:没有这样的文件或目录 [英] libjvm.so: cannot open shared object file: No such file or directory
问题描述
尝试使用此代码在我的14.10 ubuntu上的R上安装rJava包
Trying to install the rJava package on R, on my 14.10 ubuntu, using this code
if (!require(rJava)) install.packages('rJava')
获得与java相关的几个错误,包括jni问题,之后重新安装jdk,并尝试再次运行相同的代码,得到了该错误
got few errors related to java including jni problems, after reinstalling the jdk, and tried to run the same code again, got that error
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/site-library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpfFjrp0/downloaded_packages’
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘rJava’
寻找解决方案,找到几乎所有人建议(对于x64)执行这些命令
looked for solutions, to find just about everyone suggesting (for x64) to execute those commands
export LD_LIBRARY_PATH=/usr/lib/jvm/java-8-oracle/lib/amd64:/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server
sudo R CMD javareconf
但这不起作用,还有什么我可以做的吗?我将提供任何所需的详细信息
but that didn't work, is there anything else I can do? I will provide any needed details
推荐答案
当我尝试在RStudio中加载rJava时,我遇到了同样的错误。
以下解决方案适用于我
I was getting the same error when I was trying to load rJava in RStudio. The following solution worked for me
1) sudo rstudio-server stop
2) export LD_LIBRARY_PATH=/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/jre/lib/amd64/default
3) sudo rstudio-server start
执行上述步骤后,我能够在RStudio中成功运行以下内容
After performing the above steps, I was able to run the following successfuly in RStudio
> library("DBI")
> library("rJava")
> library("RJDBC")
这篇关于libjvm.so:无法打开共享对象文件:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!