Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3788996
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:05:11+00:00 2026-05-19T12:05:11+00:00

Creating this application has become a pain in the ass! Using Java I want

  • 0

Creating this application has become a pain in the ass! Using Java I want to unzip .zip files created by many different applications:
Using my 7-zip this works perfectly fine, Using somebodys winrar to compress the files completely messes them up!
Here’s my code:

 public static void ExtractModZip(File Zip, File Dest) {
        try {
            if (Zip.getName().toLowerCase().endsWith(".zip")) {
            }
            ZipFile zip = new ZipFile(Zip);
            System.out.println(zip.getName() + " opened.");
            Enumeration entries = zip.entries();
            String ModName = Zip.getName().substring(0, Zip.getName().length() - 4);
            File base = new File(Dest + File.separator + ModName);
            base.mkdirs();
            InputStream entryStream = null;
            FileOutputStream fos = null;
            while (entries.hasMoreElements()) {
                ZipEntry entry = (ZipEntry) entries.nextElement();
                entryStream = zip.getInputStream(entry);
                String entryName = entry.getName().replace('/', File.separatorChar);
                entryName = entryName.replace('\\', File.separatorChar);


                if (!entry.isDirectory()) {
                    File file = new File(base + File.separator + entryName);
                    File Base = new File(base + File.separator);
                    if (!Base.exists()) {
                        Base.mkdirs();
                    }

                    fos = new FileOutputStream(file);
                    try {
                        // Allocate a buffer for reading the entry data.
                        byte[] buffer = new byte[1024];
                        int bytesRead;
                        // Read the entry data and write it to the output file.
                        while ((bytesRead = entryStream.read(buffer)) != -1) {
                            fos.write(buffer, 0, bytesRead);
                        }
                        System.out.println(entry.getName() + " extracted.");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }


                } else {
                    File file = new File(base + File.separator + entryName);
                    file.mkdir();
                }
            }
            fos.close();
            entryStream.close();
        } catch (ZipException ex) {
            Logger.getLogger(fileUtils.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(fileUtils.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

Example:
I unzipped the fie using this method, it completely missed out a folder and certain files inside…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:05:11+00:00Added an answer on May 19, 2026 at 12:05 pm

    Try a different unzip (decompression) implementation. TrueZIP is well known.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked this Can I automate creating a .NET web application in IIS? a
I am new to creating Java web applications and came across this problem when
I am creating my java Swing application in Netbeans. At present there are more
How can I have it so Visual Studio doesn't keep re-creating this folder that
Note: I found this Creating a Word Doc in C#.NET , but that is
I had this idea of creating a count down timer, like 01:02, on the
I'm currently creating an explicit reference to this in the outer class so that
I'm creating a table that looks something like this. CREATE TABLE packages ( productCode
Hello can anybody solve this please I'm creating the object in the action class
I'm doing this system Stacked and I am creating the search function. And in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.