I'm trying to unzip files from within my Java program. Before I would try to just exec a process that would run pkunzip on my files, but I've been trying that on a Win2003 machine and would always get a strange error from Windows saying something about the environment not being set up (and yes, I was hardcoding the path to pkunzip). Anyway, for some strange reason I don't get that error anymore (and I didn't change anything on the server myself), but I had already started working on trying to use the java.util.zip package's classes to do this from pure Java code, so I'm now wondering if there's any way from within this Java package to unzip an encrypted (password-protected) zip file. Here's what I have so far:
[ August 24, 2004: Message edited by: Stephen Huey ]
In the article provided by somkiat, it said that "The Java classes that read Zip files, e.g. ZipInputStream, do not support decrypting password-protected Zip files."
Your application must find a way to let the user specify the password to decrypt the zip file... You might need to find the documents or manuals that explain how to deal with encryption and decryption with a certain zip file...
Just my 2 cents..
Co-author of SCMAD Exam Guide, Author of JMADPlus SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
posted 14 years ago
It would be easy to obtain a password from the user, but in looking at the API, I'm not really sure how to use the password obtained. However, I'm guessing this means that all the bytes of the file need to be decrypted using that password string...