简体   繁体   English

加载xlsx包时出错

[英]Error loading xlsx package

yesterday we migrated to windows 7 in our firm and also updated the java packages and also R (to 2.14). 昨天我们迁移到了我们公司的Windows 7,并且还更新了java软件包以及R(到2.14)。

Then I tried to load the xlsx package, because I rely heavly on it but i get the following error: 然后我尝试加载xlsx包,因为我非常依赖它但是我收到以下错误:

Error : .onAttach in attachNamespace()
Error: .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook")

I tried the following, but it did not work: 我尝试了以下,但它不起作用:

Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:\\Program Files (x86)\\Java\\jre6\\bin\\client",collapse=';')) 
options(java.parameters = "-Xmx1000m")

Since I never work with java i have no clue what I can do. 由于我从不使用java,我不知道我能做什么。 Can you help me? 你能帮助我吗?

Thank you! 谢谢!

sessionInfo() R version 2.14.1 (2011-12-22) Platform: i386-pc-mingw32/i386 (32-bit) sessionInfo()R版本2.14.1(2011-12-22)平台:i386-pc-mingw32 / i386(32位)

locale: [1] LC_COLLATE=German_Austria.1252 LC_CTYPE=German_Austria.1252 locale:[1] LC_COLLATE = German_Austria.1252 LC_CTYPE = German_Austria.1252
[3] LC_MONETARY=German_Austria.1252 LC_NUMERIC=C [3] LC_MONETARY = German_Austria.1252 LC_NUMERIC = C.
[5] LC_TIME=German_Austria.1252 [5] LC_TIME = German_Austria.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base 附加基础包:[1] stats graphics grDevices utils数据集方法库

other attached packages: [1] xlsxjars_0.4.0 rJava_0.9-3 其他附件包:[1] xlsxjars_0.4.0 rJava_0.9-3

loaded via a namespace (and not attached): [1] tools_2.14.1 xlsx_0.4.2 通过命名空间加载(而不是附加):[1] tools_2.14.1 xlsx_0.4.2


The interesting thing is, that the package XLConnect loads without problems.EDIT: Ok, it loads without problems but loading a workbook does not work: 有趣的是,包XLConnect加载没有问题.EDIT:好的,它加载没有问题但加载工作簿不起作用:

Error: NoSuchMethodError (Java): org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions;

So maybe it is really no Java problem. 所以也许它真的没有Java问题。 But I don't want to re-write all my code to XLConnect! 但我不想将我的所有代码重新写入XLConnect!

Nobody any ideas what I could try? 没人知道我能尝试什么?

I encountered exactly the same error and found a work-around. 我遇到了完全相同的错误,并找到了解决方法。 If you specify a library location on the network to install the package into, the error occurs. 如果在网络上指定库位置以将软件包安装到其中,则会发生错误。

## Example where error occurs: 
install.packages('xlsx', lib='\\network\R\library')
library('xlsx', lib='\\network\R\library'))

However, if you change the default location for package installation within R, then you should be able to call the package library without the error. 但是,如果在R中更改软件包安装的默认位置,则应该能够在没有错误的情况下调用软件包库。 That is, simply typing install.packages('xlsx'), and having the package install automatically to its default location, allowed the package to work properly. 也就是说,只需输入install.packages('xlsx'),并将软件包自动安装到其默认位置,就可以使软件包正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM