Free java library to zip/unzip files

Hi all,
I would like to know if there is any java library to zip and unzip files that can be used freely.
Thanks in advance,
Miguel

Miguel06 wrote:
Thanks for your answer but what I am looking for is a java class library (and not a java zip utility) similar to the one developed by Chilkat (http://www.chilkatsoft.com/refdoc/javaCkZipRef.html) but I need it to be freely distributable. Obviously, I tried to find it with google before posting in this forum, but I didn't find anything.
Does [this |http://java.sun.com/developer/technicalArticles/Programming/compression/] help?

Similar Messages

  • Any one know a free java API to access RAR files

    I am looking for a free java API to access files stored inside a RAR file. Some thing similer to java zip api but access RAR file.
    Please reply if you know any.
    Thanks

    try this:
    http://sourceforge.net/projects/java-unrar/

  • Help! Where I could find API for Java to uncompress ZIP format File?

    Please!
    How can i find it?
    Is there anyone have the source?

    If you want to unzip ZIP Files in java code, use java.util.ZipFile classes. Goto www.yahoo.com and type java.util.ZipFile in the search box and hit go and it will come up with all the methods and stuff for the class as the first hit.

  • Java.lang.IndexOutOfBoundsException when zipping larger files

    i get the error:
    java.lang.IndexOutOfBoundsException
    at java.util.zip.ZipOutputStream.write(ZipOutputStream.java:261)
    at compress.zipEntry(compress.java:126)
    at compress.Create_Zip_File(compress.java:84)
    at Test.backup(Test.java:101)
    at Test.<init>(Test.java:37)
    at Test.main(Test.java:149)
    when zipping a file which is 349MB in size I think this might be because it trying to store the file in the memory and the file is too large.What can I do to not store it in memory or if im wrong can someone point me in the right direction.
    Thanks.
    FileOutputStream zipFile = null;
        ZipOutputStream zipOut = null;
       private void listContents( File Zip_File, File dir, ZipOutputStream out )
           throws Exception
           // Assume that dir is a directory.  List
           // its contents, including the contents of
           // subdirectories at all levels.
           System.out.println("Directory \"" + dir.getName() + "\""); 
           String[] files ;  // The names of the files in the directory.
           files = dir.list();
           for (int i = 0; i < files.length; i++) {
           File f;  // One of the files in the directory.
           f = new File(dir, files);
    if ( f.isDirectory() )
    // Call listContents() recursively to
    // list the contents of the directory, f.
    listContents(Zip_File, f, out);
    else
    // For a regular file, just print the name, files[i].
    zipEntry(Zip_File, f, out);
    } // end listContents()
    public void Create_Zip_File(File Zip_File,File[] To_Be_Zipped_Files,
    boolean Skip_Dirs)
    try
    // Open archive file
    FileOutputStream stream=new FileOutputStream(Zip_File);
    ZipOutputStream out=new ZipOutputStream(stream);
    for (int i=0;i<To_Be_Zipped_Files.length;i++)
    //if (To_Be_Zipped_Files[i]==null
    // || !To_Be_Zipped_Files[i].exists()
    // || (Skip_Dirs ))
    // continue;
    System.out.println("Adding "+To_Be_Zipped_Files[i].getName());
    zipEntry(Zip_File, To_Be_Zipped_Files[i], out);
    out.close();
    stream.close();
    System.out.println("Finished zipping : "
    + Zip_File.getAbsolutePath());
    catch (Exception e)
    e.printStackTrace();
    System.out.println("Error: " + e.getMessage());
    return;
    private void zipEntry(File Zip_File, File file, ZipOutputStream out)
    throws Exception
    if (file.isDirectory())
    listContents(Zip_File, file, out);
    return;
    int BUFFER_SIZE=10240000; // 10 M
    byte buffer[]=new byte[BUFFER_SIZE];
    // Add archive entry
    ZipEntry zipAdd=new ZipEntry(file.getAbsolutePath());
    //zipAdd.setTime(file.lastModified());
    out.putNextEntry(zipAdd);
    // Read input & write to output
    FileInputStream in=
    new FileInputStream(file.getAbsolutePath());
    int len;
    int nRead=in.available();
    while((count = in.read(buffer, 0, BUFFER_SIZE)) != -1)
    out.write(buffer, 0, nRead);
    // System.out.println("loop ");
    in.close();
    out.closeEntry();

    of course!!Thanks problem solved:DI don't see how - it is very very wrong!
        private void zipEntry(File Zip_File, File file, ZipOutputStream out)
        throws Exception
            if (file.isDirectory())
                listContents(Zip_File, file, out);
                return;
            int BUFFER_SIZE=4094;
            byte buffer[]=new byte[BUFFER_SIZE];
            // Add archive entry
            ZipEntry zipAdd=new ZipEntry(file.getAbsolutePath());
            //zipAdd.setTime(file.lastModified());
            out.putNextEntry(zipAdd);
            // Read input & write to output
            InputStream in= new BufferedInputStream( new FileInputStream(file.getAbsolutePath()), BUFFER_SIZE);            
            for(int count = 0; (count = in.read(buffer)) != -1;)
                out.write(buffer, 0, count);
            in.close();
            out.closeEntry();     
        }Message was edited by:
    sabre150

  • How to Zip Excel files using File Adapter?

    Hi,
    We have tried to ZIP the Excel file with  PayloadZipBean in File adapter. But we faced some issue while zipping.
    We have seen some zunk data in excel file after zipping with PayloadZipBean. Someone please help how to zip Excel files in PI with File Adapter.
    Regards,
    Sreeramulu Konjeti.

    Hi Sree,
    If you are facing any issue with PayloadZipBean then you can use java mapping to Zip the files.
    Please find the complete Java mapping code to zipt the file
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50ce0433-4309-2b10-4bb4-d421e78463f7?quicklink=index&overridelayout=true

  • Zip/unzip desing and configuration

    Hi,
    I need to implement zip/unzip file to file scenario . can u help me complete design and configuration steps .I mean how to deploy java code. and designing in IR and how to configure in ID.
    thanq
    krishna

    Hi,
    You Do not need to Provide any JAVA Code For the same.
    SAP Provides Standard Modeules to DO so.
    Use the PaYLoadZipBean module.  
    Have a look at the SAP help link:
    [http://help.sap.com/saphelp_nw70/helpdata/en/45/da9358a1772e97e10000000a155369/frameset.htm]
    just a Few Points to remember:
    1. Place this  Before the call to Standard SAP module in case you want to Unzip the payload in the Sender Side
    2. Place it after the SAP Standard module in the receiver side.
    Hope this helps.
    Reward points if useful
    Regards,
    Abhishek

  • Zip,unzip format files supported by XI

    Dear all,
    I have two requirements
    1)1 have a huge pdf files(total 15) each of size 10mb these files need to be zipped in the sender CC ,set to  XI and un zipped at the receiver ie I need 15omb pdf files at the receiver.The idea is to reduce burden on XI.
    2)A huge Xml(400mb) file is split in to multiples of 10 these files must be zipped individually in xi and send the unzipped file to the receiver.
    Thanks.
    Srinivasa

    hi check the below links for reference
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10748ef7-b2f0-2910-7cb8-c81e7f284af5
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7086f109-aaa7-2a10-0cb5-f69bd2affd2b
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2498bf90-0201-0010-4884-83568752a857
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cc1ec146-0a01-0010-90a9-b1df1d2f346f
    note:reward points if solution found helpfull.....
    regards
    chandrakanth.k

  • Unzipping Files in Folder using Java

    Hello,
    I am working on a project and I am having trouble writing a program that will unzip all the files in a given directory (using Java). The directory is known, but the name and number of files to be unzipped will vary on each execution. The files need to be unzipped and then placed in a different specified folder.
    Thank you for your assistance.

    This should give you some idea. Be sure to import java.util.zip.
        /** unzipDirArchive */
        public static void unzipDirArchive(File inFile)
            throws IOException {
            ZipEntry entry = null;
            // Create stream to read the compressed file.
            ZipInputStream zis = new ZipInputStream(new FileInputStream((inFile)));
            // Create stream to write the output file.
            FileOutputStream fos = null;
            byte buffer[] = new byte[4096];
            int bytesRead;
            boolean dirCreated = false;
            // For each entry in the ZIP input file.
            while ((entry = zis.getNextEntry()) != null) {
                // If we have not created the enclosing directory.
                if (!dirCreated) {
                    // Create the directory.
                    int endIndex = entry.getName().lastIndexOf('/');
                    String dirName = entry.getName().substring(0, endIndex);
                    // DEBUG
                    // System.out.println("dirName is: " + dirName + ".");
                    File newDir = new File(dirName);
                    // Check if the output dir already exists.
                    if (newDir.exists()) {
                        System.err.println("Uncompress: Output directory " + dirName +
                                           " already exists.");
                        System.exit(-5);
                    else {
                        // If we successfully created the enclosing directory.
                        if (newDir.mkdir()) {
                            dirCreated = true;
                        else {
                            System.err.println("Uncompress: Cannot create directory " +
                                                dirName + ".");
                            System.exit(-6);
                    } // end if newDir.exists
                } // end if !dirCreated
                System.out.println("Inflating: " + entry.getName());
                fos = new FileOutputStream(entry.getName());
                // Copy the data from the ZIP file entry to a file.
                while((bytesRead = zis.read(buffer)) != -1)
                    fos.write(buffer, 0, bytesRead);
                fos.close();
            } // end while more entries in the ZIP file
            zis.close();
        } // end method unzipDirArchive

  • Unzipping files using java.util

    I am trying to unzip files using java.util.zip
    It works fine when I am trying to unzip a file that is already residing on the server.
    But I want to unzip the file that user will upload to the server .
    My code is uploading zip file to server but not able to unzip this zip file giving error
    java.util.zip.ZipException: error in opening zip file
    What could be the problem
    I am not getting exactly
    Can you give me any clue
    Thanks

    sounds like the uploading is the problem. Are you FTPing the file? If so check that it's being transferred in binary, not ascii.

  • Zip and Unzip files in PlayBook

    Hello all,
    Just a heads up, File Browser for PlayBook will shortly be getting an update that will allow the users to zip and unzip files. Network browsing is planned for the update after this one (free upgrade ofcourse). 
    Here is a link to the app: File Browser
    My apps: Offline Viewer and FlashLight

    that'd be great, I hope that the wait is worthy!

  • Add jar file to forms application standard java library

    Overall Problem
    I created a jar file using JDeveloper to be loaded as a bean in forms builder. But the jar file ended up being really large because I had to add some standard libraries that JDeveloper knew about but Forms didn't to this jar file, it takes forever to load in my forms application.
    Background
    Jdeveloper has a drop down list of standard libraries that aren't commonly used that a developer can have included/referenced into their java project.
    Oracle Forms Library
    One of the standard libraries in JDeveloper that can be referenced when compiling a project is the Oracle Forms library. I have to reference this library in my compilation of my java project in JDeveloper because some of the java code in this project requires the Oracle Forms library. When the jar file is created in JDeveloper the Oracle Forms Library isn't actuaally physically located anywhere in the jar file that is produced for deployment. But the jar file runs perfectly in my forms application. Forms builder and the forms application server seems to already know about the Oracle Forms library.
    Java Media Framework Library
    There is another standard library listed in JDevelopers drop down list that I recently chose to use in my Java Application, the Java Media Framework library. But my forms application couldn't find any of the Java Media Framework classes when it launched the jar file that was deployed from JDeveloper. Obviously the classes wern't physically located in the jar file I created, because I figured that the forms application server/forms builder would already know about about this standard library that JDeveloper knew about.
    Not very effective Solution
    So I physically put/included the whole Java Media Framework Library into my jar file and then my form launched fine. But it now takes forever to load. How can I add the Java Media Frame work library jar files as one of the standard libraries that the forms builder and application server already sees (Like the Oracle Forms Library) without having to put the library in the forms/java folder and wait for the this jar file to download to the user's cache?
    Side note: The Java Media Framework Library is allowing the ability to launch video from my form. Very useful tool!!! So it would be good if forms had this already added as a standard library like it is in JDeveloper. But I only see the ability to reference this library in DS 10gR2 for JDeveloper.
    Thanks,
    Michelle

    Yes I have successfully been able to run a javabean application that uses the Java Media Framework methods within a forms module. The video seems to play and interact normally in the forms environment (launched from a DS or the AS).
    Basic Requirements
    Develop the java application functionality look and feel, including adding funtionality calls to the JMF library where needed.
    Develop an Oracle Forms Interface wrapper that will be the initial class called from the bean area, to hande any communication between the bean and the form.
    Configure the deployment of the jar to physically include all the needed classes from the JMF library.
    Sign the jar file and make sure it is placed in the forms/java folder and referenced in the appropriate forms configuration files.
    Depending on the type of video that the will be played certain .dll files might need to be added to the users system folder. Using H264 (.mov) should work fine without any extra .dlls.
    Thanks,
    Michelle
    Message was edited by:
    mpoore

  • How to pass java.library.path as a VM argument in JNLP file

    I jave a jar file containing reference to sqljdbc4.jar as I am using JDBC to talk with SQL Server. It works fine through eclipse IDE when I give the fillowing VM Argument
    -Djava.library.path=C:\Users\reddys2\Downloads\sqljdbc_4.0\enu\auth\x86. Without this I get the "error message" saying that "failed to load sqljdbc_auth.dll
    Now I would like to bundle working jar file in .jnlp and invoke through browser. I tried to add vm argunment (<property name="java.library.path" value="C:\Users\reddys2\Downloads\sqljdbc_4.0\enu\auth\x86"/> ) in the .jnlp file. But still i am getting "WARNING:Failed to load the sqljdbc_auth.dll cause:no sqljdbc_auth in java.library.path"
    Any help is greatly appreciated. Here are the contents of JNLP file
    =======================================================================================
    ?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="http://xxx.16.19.56:8080/ifsdTools/" href="PF_UserList.jnlp">
    <information>
    <title>Login into PF</title>
    <vendor>XXX XXXX</vendor>
    <description>Provides ability to mirror PF Data base locally</description>
    </information>
    <resources>
         <j2se version="1.4+"/>
         <jar href="PopulateIFSDProjectForgeData.jar" />
         <jar href="Psqljdbc4.jar" main/>
         <property name="java.library.path" value="."/>
         <property name="javax.net.ssl.keyStore" value="NONE"/>
         <property name="javax.net.ssl.keyStoreType" value="PKCS11"/>
         <property name="http.proxyHost" value="proxy1.lmco.com"/>
         <property name="http.proxyPort" value="80"/>
         <property name="java.library.path" value="C:\Users\xxxx\Downloads\sqljdbc_4.0\enu\auth\x86"/>
         <property name="pfProjectId" value="proj1073" />
    </resources>
    <security>
         <all-permissions/>
    </security>
    <application-desc main-class="ifsdTools.PopulateIFSDProjectForgeData" />
    </jnlp>
    =========================================================================================================
    Edited by: 878645 on Apr 26, 2012 3:43 PM

    Thanks for the pointer. Question that I have is I am referencing sqljdbc4.jar in my application, which in turn using sqljdbc_auth.dll.
    Which one should i refernce through <nativelib>. Is it sqljdbc4.jar or sqljdbc_auth.dll.
    have added the following line to the .jnlp.
    <nativelib href="sqljdbc4.jar"/>
    But still it is complaining on sqljdbc_audth.dll. If it is sqljdbc_auth.dll, can I use <nativelib> to pass it.
    In that case does it need to be signed?. If so,
    Is it possible to sign .dll using 'jarsigner'?.
    Edited by: 878645 on Apr 26, 2012 3:43 PM

  • Read encrpted zip file and ftp unzip file

    Hi,
    I have a situation,where i need to read 3 zip files, which are encrpted, and each zip file may have lot of images and text files. all i want to do is, read these 3 zip files and unzip + ftp to another directory. No mapping is involved. if the three files are not there, it should error out.
    I have some ideas, but thought if any of you have better ideas.
    Thanks
    Pandari

    Hi Pandari
    File adapter
    module to zip and unzip
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    <b>Check this weblog:</b>
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
    Check this out !
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework%3Fpage%3Dlast%26x-order%3Ddate%26x-showcontent%3Doff
    also
    https://service.sap.com/sap/support/notes/965256
    Check this weblog on how to zip the file using XI:
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
    PayloadZip Bean
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework%3Fpage%3Dlast%26x-order%3Ddate%26x-showcontent%3Doff
    Through command line
    Check case 2 in this blog
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    or ref plsz go tru it,
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    Check this weblog on this from stefan:
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
    http://help.sap.com/saphelp_nw70/helpdata/en/84/2e3842cd38f83ae10000000a1550b0/frameset.htm
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    Zip or Unzip your Payload with the new PayloadZipBean module of the XI Adapter
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
    XI/PI: Command line sample functions -> go through case 2
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    Create encrypted ZIP files
    Thanks!!!

  • How to zip one file i have on disk with java.util.zip

    I don't know how to zip a file. I managed to do new html file, but i don't know how to zip it.
    This is my code:
    PrintWriter pw = new PrintWriter (new FileWriter(export), true);
    Thanks!

    heres a zipper class i wrote which i have butchered a bit to make more generic (its basic and at present only takes one zipentry etc, but very simple and should be easy to extend etc) Just pass it your file in its constructor and then call its zipme method. PS if it can be made better let me know so i can update my class, cheers.
    import java.io.*;
    import java.util.zip.*;
    import java.awt.*;
    class zipper
         public File file;
         public zipper(File f)
              file = new File(f);
         public void zipme()
              try
                   FileInputStream fin = new FileInputStream(file);
                   int a = (int)file.length();
                   byte b[] = new byte[a];
                   fin.read(b);
                   ZipEntry k = new ZipEntry(fin.getName());//represents a single file in a zip archive!
                   File newFile = new File("D:\\AZipFile.zip");
                   ZipOutputStream zi = new ZipOutputStream(new FileOutputStream(newFile));
                   zi.putNextEntry(k);
                   zi.write(b,0,a);
                   zi.close();
                   fin.close();
              catch(FileNotFoundException e)
                   //System.out.println("ERROR File not found");
              catch(IOException ee)
                   //System.out.println("ERROR IO exception in Zipping file");
    }

  • Problem with zip/unzip of .swf files in XP

    For some reason, zipping a .swf file in XP and then unzipping on another XP machine, the file suffix changes from ".swf" to no suffix and properties change from Flash movie to Flash object.  Consequently, linking to the file with a URL in a presentation causes the file not found error. Renaming the unzipped file to filename.swf makes it unreadable.
    Any suggestions on how to compact .swf files without them being corrupted when they're unzipped?

    Sorry to say, aknle, I use Illustrator files in every After Effects project I do these days. I have never had the issue you are describing. I often receive files form external artists that I need to change to RGB from their CMYK originals. I often need to fix their art because they are print people and think of white as the paper and the absence of ink. But the files open and track and update for me flawlessly. Always have.
    I am on CS5 (not 5.5) using a Macintosh.
    bogiesan

Maybe you are looking for

  • How to find if a user with fullaccess permission used a mailbox ?

    Hi, We used Exchange 2010 in my organisation We defined a lot of generic mailboxes and some of them have a lot of users with fullaccess permission We think that some of them don't really used this mailbox Is it possible to find, with powershell, info

  • "Missing port information" when calling web service

    I have implemented a web service that works fine as long as I use primitive types as arguments and return types, but when I add a method that takes a user-defined class as an argument, I receive the following error when calling any of the methods in

  • Jsp----microsoft access---image

    Hi everyone, I am trying to save an image in a Microsoft Access database, so i can make a query to that image using jsp, and display the image in the .jsp. The problem is that I don't know what data type to declare in "access" when i am creating the

  • IDOC for Orders

    Hello, Which transaction can I use to set up IDOC creation every time a sales order is created? Thanks.

  • Why photoshop CS5 opens twice the same image?!

    Hi there Sometimes when I have opened an image in PS I reopened from bridge or from Ilustrator as a smart object and the image duplicates in photoshop! Somebody knows what it's happening with this? is this a bug? if not what is the use of this? thank