R-Project:xlsx 包安装失败(由于 java 问题)

2024-01-02

我试图安装 xlsx 包,不幸的是,Java 有一个问题,我无法解决。

请在下面找到尝试安装 xlsx 包时产生的输出。

这是输出:


R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("xlsx")
Installing package into ‘/home/tamaspavlicek/R/x86_64-redhat-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘rJava’, ‘xlsxjars’

trying URL 'contrib/rJava_0.9-6.tar.gz'
Content type 'application/x-gzip' length 567515 bytes (554 Kb)
opened URL
==================================================
downloaded 554 Kb

trying URL 'contrib/xlsxjars_0.6.1.tar.gz'
Content type 'application/x-gzip' length 9477071 bytes (9.0 Mb)
opened URL
==================================================
downloaded 9.0 Mb

trying URL 'contrib/xlsx_0.5.7.tar.gz'
Content type 'application/x-gzip' length 312839 bytes (305 Kb)
opened URL
==================================================
downloaded 305 Kb

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -m64 -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 -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/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 -m64 -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 : '/bin/java'
archiver    : '/bin/jar'
compiler    : '/bin/javac'
header prep.: '/bin/javah'
cpp flags   : '-I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/../include -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/../include/linux'
java libs   : '-L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... 
Error: Could not find or load main class getsp
no
configure: error: Java interpreter '/bin/java' does not work
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/tamaspavlicek/R/x86_64-redhat-linux-gnu-library/3.1/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status
ERROR: dependency ‘rJava’ is not available for package ‘xlsxjars’
* removing ‘/home/tamaspavlicek/R/x86_64-redhat-linux-gnu-library/3.1/xlsxjars’
Warning in install.packages :
  installation of package ‘xlsxjars’ had non-zero exit status
ERROR: dependencies ‘rJava’, ‘xlsxjars’ are not available for package ‘xlsx’
* removing ‘/home/tamaspavlicek/R/x86_64-redhat-linux-gnu-library/3.1/xlsx’
Warning in install.packages :
  installation of package ‘xlsx’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpj1UG8a/downloaded_packages’

Java已安装:

java -version 给出以下输出:

java version "1.7.0_71"
OpenJDK Runtime Environment (fedora-2.5.3.0.fc20-x86_64 u71-b14)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

“sudo R CMD javareconf”导致:

Java interpreter : /bin/java
Java version     : 1.7.0_71
Java home path   : /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre
Java compiler    : /bin/javac
Java headers gen.: /bin/javah
Java archive tool: /bin/jar

trying to compile and link a JNI progam 
detected JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/../include -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/../include/linux -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic  -c conftest.c -o conftest.o
gcc -m64 -std=gnu99 -shared -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/lib/amd64/server -ljvm -L/usr/lib64/R/lib -lR


JAVA_HOME        : /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre
Java library path: $(JAVA_HOME)/lib/amd64/server
JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
Updating Java configuration in /usr/lib64/R
Done.

尽管如此, install.packages('rJava') 会导致:

checking Java support in R... present:
interpreter : '/bin/java'
archiver    : '/bin/jar'
compiler    : '/bin/javac'
header prep.: '/bin/javah'
cpp flags   : '-I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/../include -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/../include/linux'
java libs   : '-L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.0.fc20.x86_64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... 
Error: Could not find or load main class getsp
no
configure: error: Java interpreter '/bin/java' does not work
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/tamaspavlicek/R/x86_64-redhat-linux-gnu-library/3.1/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpnl17m7/downloaded_packages’

我不知道如何解决这个java问题。我使用 RStudio 和 Fedora。 非常感谢您的帮助。

Thanks

Tamas


如果您安装了 Java,请尝试从命令行重置 R 的 java 配置

sudo R CMD javareconf

然后再次尝试安装rJava(您可以先重新启动RStudio)

install.packages('rJava')

如果这仍然不能解决您的问题,则错误表明 R 无法加载 getsp:

checking whether Java run-time works... 
Error: Could not find or load main class getsp

首先验证 getsp 是否可访问。

locate getsp

输出可能包含多个项目,但您应该找到如下内容:

/usr/share/R/share/java/getsp.class

然后我们希望可以访问它,因此将其导出,以便 R 可以找到它:

export CLASSPATH=/usr/share/R/share/java

在同一窗口中,启动另一个 R 会话并尝试安装rJava again.

另一件需要休息的事情是 JAVA_HOME 并重新运行javareconf

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64/jre
export PATH=$PATH:$JAVA_HOME/bin
sudo R CMD javareconf

还建议unset CLASSPATH in the rJava问题 https://github.com/s-u/rJava/issues/3因为它可能会导致其他问题。如果仍然无法解决问题,您可能应该在尝试更改 JAVA_HOME 之前执行此操作并再次重置。

EDIT

鉴于这个问题在相当长一段时间内一直“未得到解答”,我想我还应该添加我的建议,即仅使用readxl https://cran.r-project.org/web/packages/readxl/index.html而是不使用 Java 的包。它安装起来更加容易,并且是 tidyverse 的一部分。只是对那些尝试使用 Excel 文件的人的一般建议。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

R-Project:xlsx 包安装失败(由于 java 问题) 的相关文章

  • 如何在 R 中将字符串解析为层次结构或树

    有没有办法将表示组的字符串解析为 R 中的层次结构 假设我的小组结构如下 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 1 3 1 1 1 3 2 1 1 3 3 1 2 1 2 1 1 2 1 1 1 2 1 2 1
  • Spring Data JPA 选择不同

    我有一个情况 我需要建立一个select distinct a address from Person a 其中地址是 Person 内的地址实体 类型的查询 我正在使用规范动态构建我的 where 子句并使用findAll Specifi
  • 通往楼梯顶部的可能路径

    这是一个非常经典的问题 我听说谷歌在他们的面试中使用过这个问题 问题 制定一个递归方法 打印从楼梯底部到楼梯顶部的所有可能的独特路径 有 n 个楼梯 您一次只能走 1 步或 2 步 示例输出 如果它是一个有 3 级楼梯的楼梯 1 1 1 2
  • 读取R中打开的Excel文件

    有没有办法将打开的Excel文件读入R 当Excel中打开一个excel文件时 Excel会对文件加锁 比如R中的read方法无法访问该文件 你能绕过这个锁吗 Thanks 编辑 这发生在带有原始 Excel 的 Windows 下 发生错
  • 如何将 Mat (opencv) 转换为 INDArray (DL4J)?

    我希望任何人都可以帮助我解决这个任务 我正在处理一些图像分类并尝试将 OpenCv 3 2 0 和 DL4J 结合起来 我知道DL4J也包含Opencv 但我认为它没什么用 谁能帮我 如何转换成 INDArray 我尝试阅读一些问题here
  • 如何在代理后面安装 Eclipse Neon

    对于 Neon Eclipse 附带了一个安装程序 我在安装程序中找不到任何配置菜单 我的java版本是 java version java version 1 8 0 72 Java TM SE Runtime Environment b
  • 什么时候可以在 Java 中使用 Thead.stop() ?

    Thread stop 的 Java 文档听起来好像如果您调用 Thread stop 世界就会终结 已弃用 这种方法本质上是不安全的 停止线程 Thread stop 导致它解锁所有已锁定的监视器 作为未经检查的 ThreadDeath
  • ConcurrentHashMap 内部是如何工作的?

    我正在阅读有关 Java 并发性的 Oracle 官方文档 我想知道Collection由返回 public static
  • 是否可以通过编程方式查找 logback 日志文件?

    自动附加日志文件以支持电子邮件会很有用 我可以以编程方式设置路径 如以编程方式设置 Logback Appender 路径 https stackoverflow com questions 3803184 setting logback
  • 使用 Guice 优化注册表

    你好 今天思考了一种优化 有一些疑问 语境 我正在使用 Guice 2 进行 Java 开发 在我的网络应用程序中 我有一个转换器注册表 可以即时转换为某种类型 转换器描述如下 public class StringToBoolean im
  • Java Swing For mac 中的 DJ Native Swing 浏览器

    我有一个用 Swing 制作的 Java 应用程序 并且使用了一个 DJ Native Swing 浏览器 当我尝试在 OS X 上使用它时 它抛出了一个NoClassDefFoundError尽管我添加了 swt jar 但始终如此 有人
  • 如何避免 ArrayIndexOutOfBoundsException 或 IndexOutOfBoundsException? [复制]

    这个问题在这里已经有答案了 如果你的问题是我得到了java lang ArrayIndexOutOfBoundsException在我的代码中 我不明白为什么会发生这种情况 这意味着什么以及如何避免它 这应该是最全面的典范 https me
  • 如何自动启动我的 ec2 实例、运行命令然后将其关闭?

    我想每周对 redshift postgres 数据库中的数据运行一次机器学习模型 我使用以下命令将 R 脚本设置为休息 apiplumbr然后我将其设置为一项任务来管理pm2 我有它 所以任务会在ec2实例启动然后继续运行 要让 R 脚本
  • 如何定义“f_n-chi-square”函数并使用“uniroot”求置信区间?

    I want to get a 95 confidence interval for the following question 我已经写了函数f n在我的 R 代码中 我首先使用 Normal 随机采样 100 个样本 然后定义函数h
  • 合并数据框而不重复行

    我想合并两个数据框 但如果有多个匹配项 则不想重复行 相反 我想总结一下那天的观察结果 来自 合并 提取两个数据框中与指定列匹配的行并将其连接在一起 如果有多个匹配项 则所有可能的匹配项各贡献一行 这是一些示例代码 days lt as d
  • 如何在 Java 中创建接受多个值的单个注释

    我有一个名为 Retention RetentionPolicy SOURCE Target ElementType METHOD public interface JIRA The Key Bug number JIRA referenc
  • 当有很多列时,使用 readr::read_csv() 导入数据时覆盖列类型

    我正在尝试使用 R 中的 readr read csv 读取 csv 文件 我导入的 csv 文件大约有 150 列 我只包含示例的前几列 我希望将第二列从默认类型 我执行 read csv 时为日期 覆盖为字符或其他日期格式 GIS Jo
  • 计算互相关函数?

    In R 我在用ccf or acf计算成对互相关函数 以便我可以找出哪个移位给我带来最大值 从它的外观来看 R给我一个标准化的值序列 Python 的 scipy 中是否有类似的东西 或者我应该使用fft模块 目前 我正在这样做 xcor
  • 如何使用play框架上传多个文件?

    我在用play framework 2 1 2 使用java我正在创建视图来上传多个文件 我的代码在这里 form action routes upload up enctype gt multipart form data
  • 无法部署 ShinyApp:readTableHeader 在“raw”上发现不完整的最后一行(使用默认值:en_US)

    我已经拼命尝试部署我的闪亮应用程序大约一周了 但不幸的是我无法停止收到以下消息 Warning message Error detecting locale Error in read table file file header head

随机推荐