Wind 8.1 error message rjavatools?

1,984 views
Skip to first unread message

Cara Ziegel

unread,
Jul 11, 2014, 3:15:32 PM7/11/14
to r-packa...@googlegroups.com
Hi, I'm trying to use the xlsx package for an online class I'm taking.  I have installed the package using rstudio's install package, and it seemed successful.  I have checked that I can see java from R and that I have no javahome set.  

When I try to use read.xlsx I get this error:

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
  java.util.zip.ZipException: invalid literal/lengths set

I've tried a few different ways to use read.xlsx, but always get this error.

I have only used R for a month in this class, and I'm not extremely familiar with installing things manually - for example, before I found I could install from Rstudio, I was running all over the web trying to figure out which file to download and where to save it to, to no avail.  

So if you have any ideas, try to use small words!!

thanks

Adrian Dragulescu

unread,
Jul 11, 2014, 5:32:46 PM7/11/14
to R-package-xlsx
Cara, 

Please send the code that you are trying to execute.  It is hard to guess what's happening without more details.  It should be as simple as this:

res <- read.xlsx("C:/Temp/infile.xlsx", sheetName="Sheet1")

Try with a really simple file first and if you're successful, try with more complicated spreadsheets.

Adrian








--
You received this message because you are subscribed to the Google Groups "R-package-xlsx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-package-xls...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cara Ziegel

unread,
Jul 11, 2014, 6:00:53 PM7/11/14
to r-packa...@googlegroups.com
but that was what I did . . . dat<- read.xlsx("gasdata.xlsx", sheetIndex=1 )   and gasdata.xlsx was already showing up in dir()

Adrian Dragulescu

unread,
Jul 11, 2014, 9:48:54 PM7/11/14
to R-package-xlsx
Can you run the example from the help file?
file <- system.file("tests", "test_import.xlsx", package = "xlsx")
res <- read.xlsx(file, 1)  # read first sheet
head(res)
If it works, then at least we know you have the package installed properly.  
Adrian

Cara Ziegel

unread,
Jul 12, 2014, 11:36:50 AM7/12/14
to r-packa...@googlegroups.com
I finally re-scoured the message boards on my class, and discovered that my error was in forgetting mode="wb" when downloading the file - the file was corrupted.

However, I'd love to know where to find the help file?  this is the first module I've downloaded and I'd love to learn how to be more self-sufficient.  

howard...@gmail.com

unread,
Nov 6, 2014, 7:52:05 PM11/6/14
to r-packa...@googlegroups.com

thanks Cara and Adrian.  I had exactly the same problem; Adrian's "test_file" worked great, and when I got to the end I noticed that Cara had uncovered my issue - failure to give the mode="wb" parameter when downloading.  Tricky because if you just let the (Chrome) browser do the download, it chooses the correct mode automatically.

iouri....@gmail.com

unread,
Apr 14, 2015, 8:48:27 PM4/14/15
to r-packa...@googlegroups.com
thanks - I had the same problem - it wasn't straightforward.
Reply all
Reply to author
Forward
0 new messages