I have problem in this unzip java codes

hi all,I have problem in this unzip java codes,I think either the pathway that i put C:.......is wrong or the codes are wrong because when i run it, the zipped folder is not unzipped. So anyone has another set of example or know how to correct it? Thanks!Please post the solution here!
This is the set of codes that i have:
import java.io.*;
import java.util.*;
import java.util.zip.*;
public class Unzip {
public static final void copyInputStream(InputStream in, OutputStream out)
throws IOException
byte[] buffer = new byte[1024];
int len;
while((len = in.read(buffer)) >= 0)
out.write(buffer, 0, len);
in.close();
out.close();
public static final void main(String[] args) {
Enumeration entries;
ZipFile zipFile;
if(args.length != 1) {
System.err.println("Usage: Unzip zipfile");
return;
try {
zipFile = new ZipFile("C:\\Temp\\FolderZiper.zip");
entries = zipFile.entries();
while(entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry)entries.nextElement();
if(entry.isDirectory()) {
// Assume directories are stored parents first then children.
System.err.println("Extracting directory: " + entry.getName());
// This is not robust, just for demonstration purposes.
(new File(entry.getName())).mkdir();
continue;
System.err.println("Extracting file: " + entry.getName());
copyInputStream(zipFile.getInputStream(entry),
new BufferedOutputStream(new FileOutputStream(entry.getName())));
zipFile.close();
} catch (IOException ioe) {
System.err.println("Unhandled exception:");
ioe.printStackTrace();
return;
}

What does the program output when it's executed? Can you copy the screen and post it here? More info can help solve the problem.
What exactly is the program supposed to do?
Add some more println() to show the program flow and what the values of key variables are. For example what is in entries after the entries() method is executed?
Some prep work on your part would make it easier for us to help.

Similar Messages

  • Unable to update itunes. help. error message when trying to update to latest version of itunes. "the installer has encountered an unexpected error installing this package. this may indicate a problem with this package. error code 2721"

    unable to update itunes. help. error message when trying to update to latest version of itunes. "the installer has encountered an unexpected error installing this package. this may indicate a problem with this package. error code 2721"

    Hello chae84swangin,
    I recommend following the steps in the article below when getting an error message trying to install iTunes:
    Trouble installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • I have problem with this add-one "down them all" , Recently it doesn't show me Size of files !!

    I have problem with this add-one "down them all" , Recently it doesn't show me Size of files !!
    also regular download doesn't show my any thing !! and I can not even resume my files ....
    i know these are direct links and i should be able to resume my downloads any time ( i have this option before )

    If an extension isn't working properly then you need to take this up with its developer.
    *http://www.downthemall.net/

  • 2 hrs & 1.8GB lost as illust CC download crashes. Anyone else have problems with this?

    2 hrs & 1.8GB lost as illust CC download crashes. Anyone else have problems with this? (It was completely downloaded & just about to install and then it dropped out)

    Bootup holding CMD+r, or the Option/alt key to boot from the Restore partition & use Disk Utility from there to Repair the Disk, then Repair Permissions.
    If that doesn't work...
    To find out if it's system wide or user specific, try this...
    Open System Preferences>Users & Groups, unlock the lock, click on the little plus icon, make a new admin account, log out & into the new account.
    Does it work in the new account?

  • TS2551 I have problem opening this file. It just take hours and hours incircle but nothing happen. Please help ! I would like this app to be reinstall.

    I have problem opening this file. It just take hours and hours incircle but nothing happen. Please help ! I would like this app to be reinstall

    What file? Does this involve iPhoto somehow?

  • Should I do this with Java Code or Stored Procs ? (for best performance)

    Hi All,
    I need to decide where should I implement my business logic, in Java code or Stored procs.
    Here is the requirement :
    - One Order has 70 products (Order_Table )
    - Can be duplicate products, so I have to do summarize / grouping by product
    - For every product, I have to check, if it is entitled for a Bonus product, then I have to Insert one to Bonus_Table.
    - This is done when/after the transaction is SAVED (COMMIT)
    The question is, which one has better PERFORMANCE :
    (1) Create a rowsetIterator on the Order details (70 products) and call a stored procedure to do the logic for every single product (so that the Insert to Bonus_Table done in stored proc). means the stored proc will be called 70 times.
    OR
    (2) After the transaction is COMMITted, call the stored procs ONCE to do the logic for all the products at once.
    OR
    (3) I do all the logic with Java Code within ADF
    Given the requirement above, which approach is most efficient / best performance ?
    Thank you very much,
    xtanto

    Problem with this is that you ask 100 people and you probably get 100 different answers. ;o)
    Many would say that you push as much business logic into the database with your data; others might say you only put data in your database and your business logic is kept on the application server.
    In reality your would probably have a mix of both and your decision would probably be influenced by your own background ...
    Can't be more precise than that.
    Grant

  • I have latest version of Java and the addin plug in is not there. I have a mac. I am not running on 32 bit. I have had so many problems with this new java updat

    I updated java to 7 up 45 (in error, this version of java does not work with vpn and according to apple, I can't go back to earlier version). The applet plugin does not show in my add ons. I am not running 32 bit. I have read and tried every article I can find. I have uninstalled and reinstalled still no luck. I have an iMac, just updated to maverick.

    See if anything here is helpful:
    *http://kb.mozillazine.org/Java#If_the_Java_plugin_does_not_appear_in_the_Add-ons_Manager_even_though_Java_is_installed

  • If you use external hard drives and have problems, read this

    My setup is :
    Power Book G4 running Mac OS X 10.4.10, with the latest version of iTunes.
    Since I have a huge amount of music, that I have aquired during the past 25 years, I was very excited, when finally an iPod with a decent HD was released.
    As you know, 70,000+ songs will not fit on your internal HD in a Power Book, so I had to move my music collection to two external Firewire HDs.
    Synching a subset of my 'overall collection' to my good old G3 iPod has never been an issue.... that was, until I hooked up my 160 GB iPod classic for the first time...
    I ran into all kinds of issues, especially, when synching a huge amount of songs at one time (i.e. 26,000 songs and more).
    The data on the iPod would be incomplete or corrupted, once the Synch was completed.
    The iTunes helpdesk was clueless and had me restore my iPod, even after I have told them several times, that I have done this before (many times) and that this definitely was not the issue.
    As mentioned in other threads, iTunes is unbearably slow, once a 160 GB iPod classic is connected. And as it turns out, the problem occures when transferring songs through this VERY slow application, from the firewire drives, to the iPod which is connected through USB. After a certain amount of songs, iTunes starts 'stuttering' (if I have to look at the 'spinning wheel' for another 15 minutes, I will lose my mind) and somehow the data transfer between iTunes and the iPod gets corrupted.
    Hence, once the Sync is finally completed (we are talking about 5 hours), the iPod is no longer able to play any songs, and all that can be done, is resetting the iPod again and start from scratch.
    How Apple missed this, during their beta testing, is beyond me. They probably only used the latest intel processors on their fastest machines.
    So if you run into similar issues, and if you have a similar setup, you might want to start synching small batches of songs.
    I hope, a fine tuned iTunes version will be released soon.

    When I first experienced this problem it appeared as though everything was transferring correctly. The progress dialogue showed that I was transferring a few thousand songs and then stop. When I looked at the ipod it showed only a few hundred (if that) had been transferred. This was about a year ago that I had this problem.
    I think what is happening is that the software is setting up the transfer but not actually transferring the files until the very end. Seems weird I know, but the problem was consistent. It only happened when I had the setting to transfer the album art selected.
    Apple was no help. But when I plugged the sync cable directly into the computer everything worked fine. I would think that a good powered hub would work as well as being plugged directly into the computer, or at least using the outlets on the back of my Apple display, but that is not the case.
    I don't know what to suggest about USB 1. Before USB 2, Apple used firewire with all of their ipods because USB was sooo slow. When USB caught up (or close enough) they changed the interface.
    You might try unselecting the option to sync album art. I know that the new interface looks pretty ugly without it, but at least you would have your music.

  • I have problem like this with all websites lately.

    problem loading sites with message like this: A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
    Script: http://www.careerbuilder.co.uk/A2EB891D63C8/avg_ls_dom.js:383

    Table > Show Reorganize Panel, or click the icon on the Toolbar.
    Yes, Filtering, as Barry notes, will hide non-relevant data. Be careful though that you don't inadvertently exclude addresses that are in, say suburbs, and should be included with others.
    It's really not difficult to scroll through a sorted list.
    Jerry

  • HT4883 i have problem with this update

    i downloaded this version as suggested by an apple guy on the phone and tried to install it but it tells me that i already have a more recent version. the thing is that i don't have java preferences in my utility folder nor i can seem to find it in the spotlight ..
    and on top java doens't let me use  a software for me very important

    I believe the following instructions are what you are looking for and need, if you feel comfortable with them:
         https://service.parachat.com/knowledgebase/226/How-can-I-uninstall-Oracle-Java-7 -and-reinstall-Apples-Java-6-on-my-Mac.html
    Hope this helps

  • I got an unsolicited Macbook Air, called Apple, got return slip but Apple says we never spoke-anyone have problem like this?

    A laptop arrives at my home, I call Apple, I get a postal service return shipping label from [email protected] and sent it back.  Apple says I never spoke to them, has locked the orders details on my Apple ID order history and has told me they won't talk about this any longer.  Eveything points to someone AT APPLE-the return was shipped down the highway in Texas from the call center I spoke to.  What is odd is how Apple does not want to talk about this any longer and suggested I contact my local police (who laughed).  So no I have a $1300 bill, an email from [email protected] and no way to prove that I spoke to them other than the email I received that they insist is not from them.  Can anyone give me any insights?  Any suggestions?  I am desperate here and I think a bad apple (pun intended) within Apple...thanks in advance.

    captwilb wrote:
    They have been clear they do not want to talk about this anymore and I should contact law enforcement.
    You should also get a new credit card.  PITA if you have auto payments setup with the card.  I just went through that.
    Re the local police, I has a similar deal with a eBay purchase.  Trotted down to the local station to file a report as eBay would do nothing unless I sent them a copy of a police report.  I was told by my police station that because the fraud involved something shipped to me, I had to report the matter to the local FBI office.  Since the item in question was about $150, I gave up.
    When you called Apple, they should have given you a RMA number which would have generated a record of your call. 
    Next time you "buy" a new MBA, would you mind sending it to me?    Sorry, just kidding.  If your credit card company won't drop the bogus charge, it would be tempting to just not pay it.  However, you screw up your credit rating and probably would be hounded by a collection agency if you were to do so.  Just keep screaming FRAUD to your credit card company until they take care of the matter to your satisfaction.

  • Does anybody have problems on this web site?

    hi, i noticed that this website seems to exit alot..
    this is typically annoying when you are in the middle of writing a reply or starting a new thread. it just suddenly closes and then i usually can't be bothered re-typing the whole thing again.
    good job i have nothin useful to say..lol..
    just thought i would ask as it could possibly be a pc bug not the forum's fault and your feedback could help me resolve the isuue.
    thanx..

    I have been fine since the Server got moved to Good 'ol Germany...But before that, it was a freakin Nightmare with 404 Errors, Not Responding, Not Found ....With the Old server, I used to make a Copy of my Posts in "Word Pad" before hitting "Reply" so I would not have to retype it ....Sean REILLY875

  • What is the problem with this table editor code?

    im using JButton as TableCellEditor component. When I clicked on button nuthing happens.
    Tell me where im wrong?
    public class Abc extends AbstractCellEditor implements TableCellEditor{
        private JButton btnSearch ;
        private BCD ref;
        private JTable table;
        public DraggedTextSearchEditor(BCD o,JTable tab){
            this.ref = o;
            this.table = tab;
            btnSearch = new JButton();
            btnSearch.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    ref.search();
        @Override
        public Component getTableCellEditorComponent(JTable table,Object value
                ,boolean isSelected,int row,int col)
            return btnSearch;
        public Object getCellEditorValue(){
            return btnSearch;
    //    public Object getCellEditorValue(){
    //        return null;
    }

    You're trying to be too tricky: dynamically linking to an Action Listener. When you compile the object ref = null and later you assign it to your dragged object--Nope, not going to work in the way you think it does. At the time of compile your ref object is null.

  • Can someone tell me the problem with this (very basic) code

    I know it's very basic but here goes
    public class MilesAndFurlongs
    // the constructor
    public MilesAndFurlongs (int Furlongs, int Miles)
    amountFurlongs = Furlongs;
    amountMiles = Miles;
    // method to add one to furlong
    public void increment()
    amount = (amount + 1);
    // method to print out total number of furlongs and miles
    public void displayLength()
    system.out.println("Furlongs: " + amountFurlongs);
    system.out.println("Miles: " + amountMiles);
    bluej says theres an illegal start of expression in displaylength()
    i know its going to be something stupid :D

    this is all of it updated...
    public class MilesAndFurlongs
    // the constructor
    public MilesAndFurlongs (int Furlongs, int Miles)
    amountFurlongs = Furlongs;
    amountMiles = Miles;
    // method to add one to furlong
    public void increment()
    amount = (amount + 1);
    // method to print out total number of furlongs and miles
    public void displayLength()
    system.out.println("Furlongs: " + amountFurlongs);
    system.out.println("Miles: " + amountMiles);
    Message was edited by:
    jaytabbmeister

  • I have updated firefox 9.0.1. when i open my yahoo email, i can see my email but contain blank. When i open my email through Internet Explorer, i don't have problem like this. I can read it.

    email contents blank

    I moved the file formhistory.sqlite to another file folder. I then started Firefox up again to see if it worked or if I needed to start it in Safe Mode. No need for Safe Mode. It now works exactly as it should. Thank you so much!!

Maybe you are looking for