当前位置: 首页 > 知识库问答 >
问题:

无法在Rstudio中安装xlsx包。rjava,无法在ubuntu 16.04中加载共享对象

陶修洁
2023-03-14
> install.packages("rJava")
Installing package into ‘/home/unix/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rJava_0.9-10.tar.gz'
Content type 'application/x-gzip' length 672577 bytes (656 KB)
==================================================
downloaded 656 KB

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : '-I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux'
java libs   : '-L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether -Xrs will be used... yes
checking whether JNI programs can be compiled... yes
checking JNI data types... ok
checking whether JRI should be compiled (autodetect)... yes
checking whether debugging output should be enabled... no
checking whether memory profiling is desired... no
checking whether threads support is requested... no
checking whether callbacks support is requested... no
checking whether JNI cache support is requested... no
checking whether headless init is enabled... no
checking whether JRI is requested... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/zzz.R
config.status: creating src/config.h
=== configuring in jri (/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri)
configure: running /bin/bash ./configure --disable-option-checking '--prefix=/usr/local'  --cache-file=/dev/null --srcdir=.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking Java version... 1.8.0_181
checking whether /usr/bin/javah actually works... yes
checking for target flags...  -target 1.4 -source 1.4
checking whether Java interpreter works... checking whether JNI programs can be compiled... yes
checking whether JNI programs can be run... yes
checking JNI data types... ok
checking whether Rinterface.h exports R_CStackXXX variables... yes
checking whether Rinterface.h exports R_SignalHandlers... yes
configure: creating ./config.status
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating run
config.status: creating src/config.h
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Rglue.c -o Rglue.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c arrayc.c -o arrayc.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c callJNI.c -o callJNI.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c callback.c -o callback.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c fields.c -o fields.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c jri_glue.c -o jri_glue.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c loader.c -o loader.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c otables.c -o otables.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rJava.c -o rJava.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c tools.c -o tools.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rJava.so Rglue.o arrayc.o callJNI.o callback.o fields.o init.o jri_glue.o loader.o otables.o rJava.o tools.o -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR
(cd ../jri && make)
make[1]: Entering directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri'
make -C src JRI.jar
make[2]: Entering directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri/src'
/usr/bin/javac -target 1.4 -source 1.4 -d . ../package-info.java ../REXP.java ../RFactor.java ../RList.java ../Mutex.java ../RConsoleOutputStream.java ../RMainLoopCallbacks.java ../RVector.java ../RBool.java ../Rengine.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
if [ -n "/usr/bin/javah" ]; then /usr/bin/javah -d . -classpath . org.rosuda.JRI.Rengine; fi
gcc -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o jri.o jri.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o Rcallbacks.o Rcallbacks.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o Rinit.o Rinit.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o globals.o globals.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux
gcc -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux
rjava.c: In function ‘RJava_request_lock’:
rjava.c:22:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
   ^
rjava.c: In function ‘RJava_clear_lock’:
rjava.c:30:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
   ^
rjava.c: In function ‘RJava_request_callback’:
rjava.c:39:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong) * 3);
   ^
rjava.c: In function ‘RJava_init_ctrl’:
rjava.c:51:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
   ^
rjava.c:52:3: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
   read(resin, buf, sizeof(ptrlong) * 2);
   ^
gcc -std=gnu99 -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o  -shared -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm -Wl,--export-dynamic -fopenmp -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre -llzma -lbz2 -lz -lrt -ldl -lm
/usr/bin/javac -target 1.4 -source 1.4 -d . ../package-info.java ../RFactor.java ../REXP.java ../RList.java ../Mutex.java ../RVector.java ../RBool.java ../RConsoleOutputStream.java ../Rengine.java ../RMainLoopCallbacks.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
/usr/bin/jar fc JRI.jar org libjri.so
make[2]: Leaving directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri/src'
rm -f libjri.so
cp src/libjri.so libjri.so
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples examples/rtest.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: examples/rtest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples examples/rtest2.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: examples/rtest2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
make[1]: Leaving directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri'
installing via 'install.libs.R' to /home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/unix/R/x86_64-pc-linux-gnu-library/3.4/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 ‘/home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava’
* restoring previous ‘/home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp1rqpcH/downloaded_packages’`enter code here`

****************************加载xlsx包****************

Library(xlsx)错误:xlsx的包或命名空间加载失败:. onLoad在rJava的loadNamespace()中失败,详细信息:调用:dyn.load(file, DLLpath=DLLpath,...)错误:无法加载共享对象'/home/unix/R/x86_64-pc-linux-gnu-Library/3.4/rJava/libs/rJava.so':libjvm.so:无法打开共享对象文件:没有这样的文件或目录

共有1个答案

欧阳勇军
2023-03-14

rJava工作可能具有挑战性。在您的情况下,我建议使用c2d4u存储库。由于您使用的是R 3.4,这将是:

sudo add-apt-repository ppa:marutter/c2d4u
sudo apt-get update
sudo apt-get install r-cran-xlsx

如果您也更新到R 3.5,您可以使用相应的回购:

sudo add-apt-repository ppa:marutter/c2d4u3.5
...
 类似资料:
  • 我希望在R x64 3.1.2中加载rJava。OS-Windows 8.1 64位 尽管安装似乎工作正常: 我在加载包时出错: 卸载和重新安装R似乎也不能修复问题。 删除旧的java版本也无济于事。

  • 我正在运行RSTudio版本1.1.442和r3.5。当我尝试加载rJava时,我得到以下错误; 库(rJava)错误:“r Java”的包或命名空间加载失败:“r Java”的.OnLoad在loadNamespace()中失败,详细信息:调用:dyn.load(文件,DLLpath=DLLpath,...)错误:无法加载共享对象“/library/framework/r.framework/v

  • 问题内容: 我无法致电中的包裹。我收到以下消息 尝试重新安装软件包时出现错误。我提供了输出 我正在使用Ubuntu 13.04。我也尝试过这无助于解决问题。关于jni.h,这里有一些解决方案。但是,不确定如何在这里使用解决方案。 问题答案: 我遇到了完全相同的问题。我的解决方案是通过安装openjdk-7- * 跟着 然后我就可以通过R在R中安装rJava 。 虽然可能不是最优雅的解决方案,但它似

  • 问题内容: 我已经看到了一些与此相关的帖子…但是我看到的所有建议的解决方案似乎都不起作用....我在EC2实例中运行R并运行以下命令尝试安装rJava,但无济于事…任何帮助将不胜感激。 问题答案: 在Ubuntu上获取rJava的最简单方法是从存储库中安装它,而不是尝试直接从CRAN中安装它。从命令行这应该可以解决问题

  • 我正在尝试在namecheap服务器上安装一些软件包到我的共享托管帐户,我是一个完全的node Js乞丐,所以如果这是一个愚蠢的问题,请与我一起,我最初尝试安装两个软件包<code>express 输出如下 它说它找不到文件包.json或无法读取/解析此文件。所以我创建了一个空白文件,看看它是否会写入数据或用必要的信息填充它,现在当我在任何模块上运行npm时,它不再发出警告,只是抛出一个错误...

  • 尝试加载xlsx包失败: R配置: