Cannot install library(xlsx) in R and look for an alternative

筅森魡賤 提交于 2019-11-28 12:43:37

This problem is generally caused by x86 vs x64 bit differences between the R session and the install Java edition. By default Java installs the x86 version and you have to search for the x64 version. if you look at the version of Java you have installed and then open your R session to the same if your using R studio you can click on Tools.GlobalOptions and then select the version you need. ;-)

Here are some possible solutions:

  1. Install 64-bit version of Java. Here is the download link of Java.
  2. Re-install rJava.
  3. Manually set the directory of your Java location by setting it before loading the library

    Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jre7") # for 64-bit version Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\Java\\jre7") # for 32-bit version library(rJava)

Source: here

For mac user, installing Java for OS X 2014-001 works for me https://support.apple.com/kb/DL1572?locale=en_US

user3295154

See this and this. The last one is "The hard way: package xlsx" but it may still help you.

user8632920

For Windows 10 Pro users 64 bit OS, use

Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jre1.8.0_144")

For MAC OS X follow these steps in order:

  1. Use this command in the Terminal: sudo R CMD javareconf

  2. Restart BaseR and RStudio...

  3. in RStudio console: install.packages("xlConnect")

  4. in RStudio console: library(xlConnect)

  5. in RStudio console: library(xlsx)

Problem solved!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!