R xlsx package error
Asked Answered
N

2

21
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
  java.util.zip.ZipException: invalid code -- missing end-of-block

Does anyone have this error when you try to use

dat <- read.xlsx("data.xlsx", sheetIndex=1, colIndex=colIndex, rowIndex=rowIndex)?
Norbertonorbie answered 4/2, 2015 at 15:56 Comment(4)
What operating system are you using?Indiscrimination
I am using Windows 7.Norbertonorbie
Having the same problem. Taking the same course :) Too bad the those Coursera instructors from JH don't seem to have much time to update slides or correct questions. The solution by @Deep-B fixed my problem. The download must corrupt the file somehow so it can't be read properly. Using WB fixed it.Scouring
@Norbertonorbie - Were you able to solve this issue? I am facing this with tabulizer() in RPretzel
P
52

I had this problem with a file downloaded from the internet using R command line, for an online course. Found that apparently the download mode needs to be set properly as write-binary (wb) since xlsx is basically a binary file (zip). Who knew?

If that's what you did too, re-download the file with the mode set properly; like:

download.file(fileUrl, destfile='./data/sample.xlsx', mode='wb')
Pucida answered 11/2, 2015 at 0:3 Comment(0)
I
1

The version of java you have installed is likely incompatible with the xslx package. Try replacing your default java with the 64 bit version: https://www.java.com/en/download/faq/java_win64bit.xml.

Indiscrimination answered 5/2, 2015 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.