What is the best way of installing the R package XLConnect in Ubuntu 12.04 x86?

I tried to manually install it via R, using install.packages("XLConnect",dependencies=TRUE), but after half an hour of compiling, when I tried to load it, I got this error:

> require(XLConnect)
Loading required package: XLConnect
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘XLConnect’

I googled for XLConnect Ubuntu but couldn't find any obvious name for the package.

3 Answers 3


The way you described is the standard way of installing packages in R. XLConnect should normally install fairly quickly. It may take a while to download the packages as XLConnect is about 1.6MB in size and the dependency XLConnectJars is about 16.5MB in size (you may try different mirrors).

An alternative is to download the source packages (XLConnect & XLConnectJars) from CRAN (http://cran.r-project.org/web/packages/XLConnect/index.html) and then to use install.packages("/path/to/pkg.tar.gz", repos = NULL)


In my case the problem was with the default version of java. I've changed it a few times but forgot to update it for R. (Although I am using Ubuntu 14.04 x64, the general way of installation/configuration of R is the same)

Installation error snippet:

Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.

As you can see the problem was pretty obvious, but I missed it during the installation process.


If Java development kit is not yet installed on your machine, check this solution to do so.

Then it is simple. Type this into the terminal:

$ sudo R CMD javareconf

then install XLConnect in R:

> install.packages("XLConnect", dependencies=TRUE)

Hope it helps.


On Ubuntu 16.04, the easiest was to do this in a terminal:

sudo apt install r-cran-rjava

And then in a R session:

  • using r-cran-rjava was key for me. I was then able to run install.packages("XLConnect") successfully. Jun 30, 2018 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.