Zipped files created with Java won't unzip with Java

Hello there,
I have written a class for unzipping a zip file using the 'ZipFile' class. It works perfectly fine when I extract zip files that have been created with XP, Winzip, or Winrar.
I am now experimenting with creating zip files using the ZipOutputStream (http://forum.java.sun.com/thread.jspa?forumID=256&threadID=366550 by author smeee). The code works great for creating the zip file, but when I try and unzip it with the zipfile class mentioned above it throws an exception.
The error that the following code gives me when it tries to convert an element from the enumeration to a ZipEntry is this: java.io.FileNotFoundException: C:\testfiles\out\high\BAUMAN\00001.jpg (The system cannot find the path specified)
NOTE: The file is there by the way!!! :-)
See the code for extracting here:
try {
             zippy = new ZipFile(fileName);
             Enumeration all = zippy.entries();
             while (all.hasMoreElements()) {//loop through all zip entries
                          getFile((ZipEntry)all.nextElement()); <<<=====FAILS HERE
} catch (IOException err) {
             System.err.println(err.toString());
             return;
}Now if I extract the zip file with winzip, then rezip it with winzip and run the above method again it works with no errors. Any thoughts. Any help would be greatly appreciated.
Jared

Hello All,
For anyone else who use the forum posting by smeee as a guide to create a zipper (http://forum.java.sun.com/thread.jspa?forumID=256&threadID=366550 by author smeee).
I was tracing through the code and found that there is a statement that adds 1 character (strSource.length()+1) to the source path. This was causing the following bug:
In windows it was placing objects like this \myfolder\myfile.txt
In unix it was placing objects like this yfolder\myfile.txt
Naturally a path like \myfolder... in the zip index was causing problems. I have added a case statement that tests the OS and then adds two chars if windows to compensate for the 'C:' and does nothing if Unix. The code now runs perfectly on either OS.
Thanks for your response guys!
Jared

Similar Messages

  • Is there a way to restore photos from Drop box to my desktop iPhoto in a large batch instead of one at a time? I tried and a zip file was downloaded but won't open. Says file format not recognized.

    Is there a way to restore photos from Drop box to my desktop iPhoto in a large batch instead of one at a time? I tried and a zip file was downloaded but won't open. Says file format not recognized. I see how to do it one at a time with the "download" button in Dropbox but that's so cumbersome for lots of photos.

    Have you tried these avenues?
    Contact us - Dropbox
    Dropbox Help Center
    Dropbox Forums
    Submit a help request - Dropbox
    OT

  • PDF files created in Preview won't open in Adobe Reader

    I consider Preview to be a swiss army knife when it comes to working with PDF and graphic files. Lately (since the last OS update?) PDF files created in Preview won't open in Adobe Reader. Reader either crashes or just becomes unresponsive. I've been able to open the files in older versions of Adobe Professional but Reader 8 or 9 can't open the files. Anyone else experiencing these problems?

    Yes. We noticed this problem after upgrading to 10.6.7. When we made a PDF from Word 2011 or even Text Edit through Adobe's "Save as Adobe PDF" it would hang. When we made a PDF using Apple's "Save as PDF" it would lock up Acrobat Pro 9 and also Acrobat Pro X. NOTE that this only happened using Adobe OTF fonts.
    I posted this problem on Adobe's forum and received a message from admin there that this was caused by a change in font handling with Apple's 10.6.7 update.
    As of yet, no solution has been posted. I also received a message from Adobe's Tech Support that it was forwarded to their engineers.
    Still waiting.

  • Pogo won't play games java won;t work with firefox

    I was playing pogo and it came up to update Java. Did it and now can't play most of the games like canasta. Says java won't work with firefox.....it did before. try for 4 days not and no luck

    Java is working properly. Still not loading games

  • ZIP file created in OS X won't open correctly in XP

    Hi there,
    I created a ZIP file of a 196MB folder (full of pictures) in OS X using the right-click, "Compress." When a friend tried to unzip this file in Windows XP, the only file inside the archive was a 0KB file titled _MACOSX. The ZIP file itself was still the correct size, but it was essentially 196MB of empty space. When I open the same ZIP file on my Mac, everything appears as it should,
    Any thoughts/ideas? Thanks, in advance, for your help.

    You're right - my friend was trying with the built-in XP ZIP support.
    I'll have him try one of those programs. Thanks.

  • Read zip files created by ZipOutputStream

    Hello :)
    I am wondering if it is possible to create a zipfile using ZipOutputStream, which can be read using ZipInputStream with out using the ZipFile work-around discussed in http://forum.java.sun.com/thread.jspa?forumID=256&threadID=492219. This is no option for me, because we have a lot of client applications deployed, which cannot easily be altered.
    Are there any (third-party) libraries which I can use?
    -M1chael

    try it
    // These are the files to include in the ZIP file
    String[] source = new String[]{"source1", "source2"};
    // Create a buffer for reading the files
    byte[] buf = new byte[1024];
    try {
    // Create the ZIP file
    String target = "target.zip";
    ZipOutputStream out = new ZipOutputStream(new FileOutputStream(target));
    // Compress the files
    for (int i=0; i<source.length; i++) {
    FileInputStream in = new FileInputStream(source);
    // Add ZIP entry to output stream.
    out.putNextEntry(new ZipEntry(source[i]));
    // Transfer bytes from the file to the ZIP file
    int len;
    while ((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
    // Complete the entry
    out.closeEntry();
    in.close();
    // Complete the ZIP file
    out.close();
    } catch (IOException e) {

  • Zip file created in Snow Leopard can't be opened on a PC

    Hi,
    I've created a zip file of a folder containing Word and pdf files using File>Compress in Snow Leopard.
    After emailing to clients, they cannot open the zip file on their PCs.
    Any help? I thought zip was supposed to be universal.
    Thanks in advance!

    All clients, or some clients? How big are the zip files?
    Usually when this happens, one of two things is going on: one of your mail servers is truncating the message (cutting off part of the attachment) because the message exceeds some pre-determined maximum message size (or the mailbox goes over a quota), OR one of you is running a virus/malware scanner on your mail server that objects to certain file types (it's not uncommon to strip .ZIP, .COM, and .EXE files).
    There's also the possibility that a Windows client just doesn't understand the file's type. While that shouldn't be, it does happen sometimes (I've seen it with Lotus Notes, for example). In that case, the recipient should save the attachment as a file on their desktop and open it from the desktop.

  • Zip file created on OS X fails to open in Windows

    I have created a 10 GB zip file (I suppose that it is a zip 64 file) as a backup of my Mac. I have moved it into a Windows computer, however, whatever program I use, it fails to open. The closest I got was using a 3rd party zip program, which succeeded in reading the directories, but not the individual files. Is there a program that I can use, or is this only compressible on a Mac (on a Mac, I have succeeded in uncompressing the file)?

    There are of course several different companies that make and furnish there product on the market many are free while others you have to pay for. In all the years I have been playing with computers I have found this one to be one of the best on the market.
    http://mac.winzip.com/features.htm
    Scroll down and you will find the capabilities. You can create and open either Mac or PC.
    They also offer a trial version so you can see if this is what you want.
    Cheers
    Don

  • After installing 10.9.2(Maverik), Java will no longer work.  I went to the java site and downloaded.  However, the new java won't work with maveric either.  What do I do?

    After installing Maverick 10.9.2, Java will no longer work. I went to Java Site to install latest Java, but Maverick won't recognize it.

    Java SE Runtime Environment 7 1.7.0_51

  • Help! Jpg, Png, Tiff files creating on MAC won't open on PC

    Ok...I'm new to MAC and I'm creating all of my images in Photoshop as i have always done on my PC. But now when i save anything as a JPG or PNG nobody using a PC can open them.
    I've checked the file extension, etc. I don't understand what I'm doing wrong.
    Please Help

    How does one see a JPG image in a plain text message? HTML vs. plain text is not the problem. The problem is that Yahoo (and many other mail clients) can choke on Mac Finder and Photoshop previews and extended metadata in the JPG file if it is not prepared and sent properly.
    Try these three steps one at a time until you find success...
    1) Use the 'save for web' function in Photoshop to produce your JPG files.
    2) Make sure that your mail program is set to send a type of MIME encoding compatible with the recipient's system (check the box for 'Windows-friendly attachments').
    3) If you are not presenting graphic HTML mail with images and don't care that the recipient has to download and extract a package of images, wrap your JPG files in a ZIP archive.

  • .swf file created from Indesign won't open in Flash Player

    I have created an interactive flash presentation using Indesign. For several weeks I have made edits, exported a .swf file and opened the file by double-clicking it to open in Flash Player. From there I was able to export an .exe file with an embedded projector for users that may not have flash player. The file does not open and asks whcih progrma I would like to open with when clicking the file.
    I am running Windows XP, Adobe CS5
    Thanks for your help.

    That sounds more Windows file association issue.Have you tried to Right-Click your SWF and choosed Open With (or something like that), you can choose Flash Player from that list if it´s installed.

  • InDesign File created on PC won't open on Mac

    My office is collaboraing with a consultant to create a document in InDesign. We are on PCs and she is on a Mac. We have sent her our .indd files and she is unable to open our InDesign files (not sure if there is an error message or what, I will get more information from her ASAP). Any thoughts on why? Suggestions?
    It is my understanding that the programs are compatible crossplatform. We are running CS2, unsure what she is running, but if opening different versions works the same as other Adobe programs, it would know, and give you a warning, if that were the problem.
    I'll update with more information as I get it, but there may be an easy solution that I am missing.
    We are an architecture firm and have minimal knowledge of InDesign. We only use it every now and then for very basic layouts and have never attempted or needed to share files, so bear with me if there is a simple explaintion!  Thanks.

    Thanks all for the help, but we have decided to work around it differently.
    She was using CS1, and the message she was getting was that there are additional plug-ins required, and she said that when she attempted to download them, CS1 was too old a version.
    INX also did not work, not sure why, but not too concered at this point.
    Thanks anyway.

  • Unicode characters with accents won't display in Java Swing applications

    I'm using FreeMind (a Java Swing application) and I need to enter classical Greek characters with accent marks. When I type an accented Greek character, FreeMind displays the unaccented character. However, I can type the accented character in MS Word, then copy and paste into FreeMind, the accented character appears.
    One of the FreeMind developers indicated this was a Java Swing issue, not FreeMind, and suggested I test with another Swing application. So, I installed jEdit and got exactly the same results. I can paste an accented character into jEdit, but I cannot type it in directly.
    I'm using Windows Vista with Java 6 Update 22 (build 1.6.0_22-b04). I also tested on a XP Pro box with Java 1.6.0_18-b07 and got the same result.
    One other note: A couple days ago, I was able to type accented Greek characters into FreeMind. But it only worked for a couple days and then the behavior reverted to unaccented characters. It is possible, but I don't recall specifically, that I updated Java during the time and that may indicate a bug in one version of Java but not another.
    Any assistance or guidance would be greatly appreciated!
    Darin

    Walter,
    The link you provided does not appear to describe the Greek Polytonic keyboard. (The page also describes using the "Option" key as the dead key. There is no "Option" key on my keyboard. I'm using a Sony VGN-NS140E purchased in Chicago, i.e. standard physical US keyboard.)
    Please see http://darindavis.net/languages/keyboard_Greek.pdf for a detailed description of how to use the Greek (Polytonic) keyboard in Windows to produce a complete set of accented classical Greek characters. This method works in MS Word and Notepad. I enabled the Greek (Polytonic) keyboard with:
    Windows (Vista) Start > Control Panel > Regional and Language Options > Change Keyboards > General > Add > Greek (Greece) > Greek Polytonic
    A test that will demonstrate whether you can replicate the error is to do the following in both MS Word (or Notepad) and jEdit (or FreeMind):
    1. Enable the Greek Polytonic keyboard
    2. Type "\" then "e" which should produce an epsilon with smooth breathing and grave accent (ἒ)
    When I do this in MS Word or Notepad, I see the epsilon with smooth breathing and grave accent. When I do this in jEdit and FreeMind, I only see an epsilon.
    I recorded a screencast to illustrate the problem: http://www.screencast.com/t/TRKkKQrCgbN
    Actually, this problem is transient. Sometimes FreeMind or jEdit will display accented characters, other times it won't. Ironically, the first time I recorded the above referenced screencast, a few characters in jEdit did appear with accents. A couple minutes later, I re-recorded the screencast and as you can see jEdit did not display the accents. Between the two recordings I literally did nothing other than stop the Jing recording and start a new one. There is another variable at play here and I can't determine what it is. The most likely source seems to be Java since MS Word and Notepad consistently display accent characters.
    Thanks,
    Darin

  • Seq file created via V2013 can't open with V2014?

    hello, I created a .seq file with V2013 sequence editer without protection, but this file can't be opened with V2014 spequence editor in another computer and show a dialog below: error code:-17100
    Solved!
    Go to Solution.

    thanks for your reply.
    sorry the interted image was missing, attached it as a file, can it be seen now?
    just do a double check, the file works well under V2013.
    and the .seq file was saved in 'Binary' format.
    Attachments:
    ScreenHunter_1.jpg ‏15 KB

  • 'Pages' docs created on iPad1 won't open with iPad3

    I use my iPad with my band for notes and occasional lyrics. I created 'Pages' documents on my iPad 1 and my MacBook Pro. Now that I have an iPad 3, previous documents will not open. Why?

    Why? Hard to say. Are you using iCloud on the new iPad and is it setup on the new iPad?
    You can try quitting Pages completely and then restart the iPad. If that doesn't work, reboot the iPad.
    Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar. Restart the iPad.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

Maybe you are looking for

  • Sites using TALEO for job searches no longer works in 19, worked in last official 18 release

    Company websites which use the TALEO job search/apply app/site, no longer work right in 19, they worked fine in 18.xx. Specially, the job search function does not work right when entering the TALEO job search parameters then hitting SEARCH FOR JOB do

  • Bank data problem

    Dear Expert What is bank data in report bank directory S_P99_41000166 ? It is included bank data in customer/vendor master or not? Is incoming payment bank is maintain in customer master data? Kindly advice Thank you.

  • Premiere Pro Not Accepting .PRPROJ File Extension

    Hi, Have just purchased the official Adobe tutorial book "Adobe Premiere Pro CS3 Classroom in a Book" to learn the fundamentals of the programme and being a "newbie" have encountered numerous problems. The most frustrating is when I go to open the le

  • Setting Message Class via Content-Type for Faxes

    Hello, I am trying to set the message class for inbound email messages (with a fax attachment) from the internet.  The class that I am trying to set is IPM.Note.Microsoft.Fax.CA.  Exchange 2013 SP1 is being used. I have a transport rule set up which

  • Strange Problem With Opening FaceBook

    Hi When I sign in in Facebook with my own account, the page ill load in no style mode. But the strange point is hat If I sign in with my friend account everything will be OK. Another thing when I sign in with my own account firefox will show me a unt