kkmishra
kkmishra

Reputation: 709

java.util.zip.ZipException: error in opening zip file while having whitespace in url path

I have a URL, which contains a white-space in middle, When I invoke the new JarFile() constructor on this file, I am getting an exception "java.util.zip.ZipException: error in opening zip file"

I am trying the following url

URL url = file:/usr/local/mvn%20repo/javax/persistence/persistence-api/2.0/persistence-api-2.0.jar

and creating JarFile object

JarFile jarFile = new JarFile(url.getFile());

and getting error following error:

java.util.zip.ZipException: error in opening zip file

Thanks KK

Upvotes: 0

Views: 1501

Answers (1)

cmbaxter
cmbaxter

Reputation: 35463

Try file:// as the protocol. So in total it would contain 3 slashes and look like this:

file:///usr/local/mvn%20repo/javax/persistence/persistence-api/2.0/persistence-api-2.0.jar

Upvotes: 1

Related Questions