Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to determine the maximum allowable length of a filename for Window ?

807569Jun 28 2006 — edited Jun 28 2006
Hi all,

Could I know how to determine the allowable file length (the length of the absolute path) for a file in Window environment?

Due to some reason, I generated a zip file with a very long filename ( > 170) and put in a folder(the length of the folder path around 90). The length of the absolute path is around 260.

I used FileOutputStream with the ZipOutputStream to write out the zip file. Everything is working fine while i generating the zip file.

However, while i try to extract some files from the zip file i just created, i encountered the error

java.util.zip.ZipException The filename is too long.

I am using the class ZipFile to extract the files from the zip file like the following
String absPath = "A very long filepath which exceed 260";
ZipFile zipF = new ZipFile(absPath);  //<-- here is the root cause
Is it possible to pre-determine the maximum allowable filepath length prior i generate the zip file ? This is weird since i got no error while i created the zip file, but have problem in extracting the zip file ......

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2006
Added on Jun 28 2006
1 comment
224 views