Creating zip-files from within Bridge?

Is there anybody who has got a script that works with Bridge CS5.5?
I got only this, but it appears not to work with my Bridge CS5.5: http://forums.adobe.com/message/3568148#3568148
Anybody can help?

Hmm,
today I started it up and there is no error message anymore. I can activate the script in Bridge Preferences/Startup Scripts.
The only problem is, I don't know on which part of the program I would find the zip action now...
Anybody has run the script and can tell me where it appears? Is it when I rightclick a file that I can choose to zip it?
Or is it at the same part where I can create a pdf with contact prints?
Thx

Similar Messages

  • How to use .dbf files zipped into a .zip file from within a java program

    i have a .zip file containing several .dbf files.
    the zip file is automatically downloaded regularly and data from the .dbf files is inserted into the database.
    how do i facilitate automatic extraction of a zip file or how do i fetch data from the .dbf file? (this cannot be done manually)
    anu.

    you could write a little polling class checking the zip file. you can use the java.util.jar package to extract the zip file (http://java.sun.com/docs/books/tutorial/jar/api/index.html). you could also use Jakarta ant (http://ant.apache.org/manual/index.html) to do this job (core task "zip") and call ant's target file on a regular basis (dependend on the OS you use, you can set os tasks/schedules).

  • Possible to create a JAR file from within a java app?

    Is it possible to create a jar file from within a java application?
    Can it be done more elegantly than by spawning-off another
    process with the Runtime and exec() portions of the api?
    Thanks
    Scott

    Thanks! I was mislead by the API notes for java.util.jar:
    The JarOutputStream class is used to write the contents
    of a JAR file to any output stream.
    I was looking for a class or method to make jar files.
    Seems this is it ;)
    Thanks
    Scott

  • Read a zip file from Application server.

    Hi,
    Is there a way to read a zip file from the applicatoin server to internal table in ABAP program?  The operation system is running MS windows server.  The zip file contains only 1 text file.  I tried to use open dataset 'uncompress', and use read dataset, but read dataset gave me sy-subrc = 4.  Any feedback is greatly appreciated.
    Thanks.

    hi,
    to convert xstring to text you can use this:
    DATA unzipped_data TYPE xstring.
    DATA text_data TYPE string.
    DATA conv_x2c TYPE REF TO cl_abap_conv_in_ce.
    conv_x2c = cl_abap_conv_in_ce=>create( ).
    conv_x2c->convert( EXPORTING input = unzipped_data IMPORTING data = text_data ).
    moreover, if you want to split your text at "end of line" (CR LF in microsoft windows) into lines:
    DATA text_lines TYPE TABLE OF string.
    SPLIT text_data AT cl_abap_char_utilities=>cr_lf INTO TABLE text_lines.

  • How to get the entries in a jar/zip file contained within a jar/zip file?

    If I want to list the jar/zip entries in a jar/zip file contained within a jar/zip file how can I do that?
    In order to get to the entry enumeration I need a Zip/JarFile:
    ZipFile zip = new ZipFile("C:/java_dev/Java_dl/java_jdk_commander_v36d.zip");
    // Process the zip file. Close it when the block is exited.
    try {
    // Loop through the zip entries and print the name of each one.
    for (Enumeration list =zip.entries(); list.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) list.nextElement();
    System.out.println(entry.getName());
    finally {
    zip.close();
    Zip file "java_jdk_commander_v36d.zip" contains two zip entries:
    1) UsersGuide.zip
    2) JDKcommander.exe
    How to list the entries in "jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip!/UsersGuide.zip"?
    The following code:
    URL url = new URL("jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip!/UsersGuide.zip");
    JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
    zipFile = (ZipFile)jarConnection.getJarFile();
    would point to "jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip", which is no help at all and Class JarURLConnection does not have an enumeration method.
    How can I do this?
    Thanks.
    Andre

    I'm not sure I understand the problem. The difference between a zip and jar file is the manifest file; JarFile is extended from ZipFile and is able to read the manifest, other than that they are the same. Your code
    for (Enumeration list =zip.entries(); list.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) list.nextElement();
    System.out.println(entry.getName());
    }is close to what I've use for a jar, below. Why not use the same approach? I don't understand what you're trying to do by using JarURLConnection - it's usually used to read the jar contents.
    String jarName = "";
    JarFile jar = null;
    try
        jar = new JarFile(jarName);
    catch (IOException ex)
        System.out.println("Unable to open jarfile" + jarName);
        ex.printStackTrace();
    for ( Enumeration en = jar.entries() ;  en.hasMoreElements() ;)
        System.out.println(en.nextElement());
    }

  • Unable to create PDF files from any application in any Acrobat version

    Hello, I am hoping someone can help me find a solution to a problem I am having creating PDF files.
    I have searched the Internet for a solution to this problem and can't find any information that helps me.
    I am running OSX 10.8.5 on a 2.5 GHZ Intel i5 Mac Laptop
    I cannot create PDFs from any program, Quark, Word, ect.
    When I try to print to the PDF printer, the printer pauses when it tries to open the Distiller. When I click resume, it pauses itself again.
    I have tried to save the document and create the PDF from within the distiller itself and get this error log:
    %%[ Error: undefined; OffendingCommand: MMXPR3 ]%%
    %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
    %%[ Warning: PostScript error. No PDF file produced. ] %%
    I was originally using Acrobat 8, But I installed the trial version of Acrobat 11 and it has the same problem.
    The problem seems to be something to do with the distiller. I have a lot of Adobe software so I am trying to avoid a clean/re-install of Adobe software but will do it as a last resort.
    Thanks in advance for any suggestions.

    Hi,
    Besides pamma has suggested, here are similar issues, you can take a look at:
    http://unsolicitedbutoffered.blogspot.com/2014/01/quick-fix-volume-syntax-error-when.html
    http://crowdsupport.telstra.com.au/t5/T-Suite-Applications/There-was-an-error-opening-this-document-The-filename-directory/td-p/197425
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • Why can I not create pdf files from MS Word documents?

    I'm using Acrobat Pro XI (11.0.5), and Microsoft Word 2007:  I've noticed just recently that, whenever I try to create a pdf file - from within Microsoft Word - I get a message:  Word has stopped working"....  and then the word program crashes.   Then I get a message that says the adobe add-in isn't working and recommends that I disable it.   This is extremely frustrating!  I've tried going into Acrobat directly to create the pdf, to no avail.  I've tried utilizing the "Repair Acrobat Installation" and that doesn't seem to work either.
    The only thing I've noticed which might have caused this problem is I just recently updated Adobe Reader - is there some "conflict" going on between having these two Adobe products installed on the same Computer?

    See: Zanelli Multipage Importer
    http://indesignsecrets.com/zanelli-releases-multipageimporter-for-importing-both-pdf-and-i ndd-files.php/comment-page-1

  • I can't create PDF files from DWF files

    I'm looking for a solution for creating PDF files from DWF files. When I attempt to create a DWF file to PDF, the file has problems being created. Does anyone have a solution to this?

    We are trying to print to pdf format from a dwf (Autodesk Design Review) drawing file.  DWF is autodesk’s version of PDF.  In autocad, you can print to either dwf or pdf.  However, some of the fonts within autocad are not recognized by adobe so the fonts often don’t print properly.  Thus, we print to dwf first, then print again to pdf.
    We operate 2 basically identical computers; the one computer is able to print from dwf to pdf and the other is not.   When I say not able, only part of the drawing actually prints; like it is not able to process the data.  The computer that cannot print from dwf to pdf, can actually print directly to pdf from Autocad.    It just cannot print from dwf to pdf.
    Both computers are running Windows 7, Autocad Architecture 2015, and Adobe acrobat X. 
    Let me know if this is enough information.

  • Calling a created Java file from an AIR application

    I've got a guy helping me out who is creating a Java file that outputs an F1 keypress to the operating system/desktop (which Flex alone can't do.
    My problem is I need to know how I can call/activate this file from within an AIR application. I want my app to be ready for when he has created it for me but I've never used Flex to call an application so I would not know what classes need to be called or if any script would be required.
    In the following simple code lets say if the Java file itself was called keypress.java (or whatever file extension a java file has) what code would need to be added in, including imported classes, to make the click of the button activate this java file?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Button id="KeypressButton" label="Button" horizontalCenter="0" verticalCenter="0" click=""/>
    </mx:WindowedApplication>

    I think one solution is to use a Java proxy to call the Web services.
    In the Java proxy you can have a method that accepts the user/pass and sets them correctly for the Web service.
    Then you expose that Java proxy as a data control (right click, create data control) - and then create a page that invokes that method.
    (For the basics of working with a POJO data control see: http://blogs.oracle.com/shay/2009/07/java_class_data_control_and_ad.html )

  • Problem in creating zip file.

    Hi,
    I am using the zip package to create a zip file.The code is given below :
      ZipOutputStream out = new ZipOutputStream(new
      BufferedOutputStream(new FileOutputStream("d:\\abc\\target.zip")));
        byte[] data = new byte[1000];              
        BufferedInputStream in = new BufferedInputStream
    (new FileInputStream("d:\\abc\\xyz.log"));
        int count;
       out.putNextEntry(new ZipEntry("d:\\abc\\target.zip"));
       while((count = in.read(data,0,1000)) != -1)
       out.write(data, 0, count);
       in.close();
       out.flush();
       out.close();The problem is that the zip file created is having no files when i try to zip files from locations other than the program file location ie other than current drive.
    Could you please suggest me a solution so that it zips file from any location. Thanks in advance.

    BRAVO wrote:
    Hi,
    I am using the zip package to create a zip file.The code is given below :
    ZipOutputStream out = new ZipOutputStream(new
    BufferedOutputStream(new FileOutputStream("d:\\abc\\target.zip")));
    byte[] data = new byte[1000];              
    BufferedInputStream in = new BufferedInputStream
    (new FileInputStream("d:\\abc\\xyz.log"));
    int count;
    out.putNextEntry(new ZipEntry("d:\\abc\\target.zip"));
    while((count = in.read(data,0,1000)) != -1)
    out.write(data, 0, count);
    in.close();
    out.flush();
    out.close();The problem is that the zip file created is having no files when i try to zip files from locations other than the program file location ie other than current drive.
    Could you please suggest me a solution so that it zips file from any location. Thanks in advance.My advice would be to tryout something as given below and checkout whether that can
    a). Give you Exception Message/stack trace if an error has occured
    b). Check whether the appropriate code change works
    public compressFile(String inputFile,String destFile){
    ZipOutputStream out = null;
    byte[] data = null;
    BufferedInputStream in = null;
    try{
        out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destFile)));
        data = new byte[1024];
         try{               
             in = new BufferedInputStream(new FileInputStream(inputFile));
             int count = -1;
             out.putNextEntry(new ZipEntry(inputFile));
             while((count = in.read(data)) > 0){     
                out.write(data, 0, count);
           }catch(Exception e){
               System.err.println(e.getMessage());
               e.printStackTrace();
           }finally{       
                  if(in != null)
                     try{in.close();}catch(Exception ex){}
       out.flush();
    }catch(Exception exp){
        System.err.println(exp.getMessage());
        exp.printStackTrace();
    }finally{
      if(out != null)
         try{out.close();}catch(Exception e){}
       out = null;
       in = null;
    }in order to compress the file we can call the method something like
    compressUtilObj.compressFile("d:\\abc\\target.zip","d:\\abc\\xyz.log");Hope that helps :)
    REGARDS,
    RaHuL

  • HOW TO CREATE PDF FILES FROM AUTOCAD 12

    I'M USING ACROBAT X TO CREATE PDF FILES FROM AUTOCAD 12 DRAWINGS.  THE PROGRAM RANDOMLY LEAVES OUT TEXT AND IMAGES.  IT ALSO STRUGGLES WITH TIFF, JPEG AND PDF IMAGE FILES EMBEDDED WITHIN THE AUTOCAD DRAWING.  THIS HAS BEEN AN ONGOING PROBLEM WITH ACROBAT.  I WAS HOPING THE UPGRADE TO  X WOULD ELIMINATE THE PROBLEM BUT IT HAS NOT.

    Hi Joao,
                    Verify these links hope it may helps...
    http://www.devx.com/xml/Article/16430/1954
    http://technopaper.blogspot.com/2008/06/using-xsl-fo-to-create-pdf-files.html
    http://www.ibm.com/developerworks/xml/library/x-xslfo/
    http://www.antennahouse.com/XSLsample/XSLsample.htm
    Regards,
    Anil.

  • How to access script from within Bridge

    I have considerable experience scripting InDesign, but this is my first
    Bridge script...
    The following script does what I want from within the ESTK, but I have
    no idea what to do to make it runnable from within Bridge... :(
    Any pointers?
    var brSel = app.document.selections[0].spec.toString();
    var bt = new BridgeTalk();
    //brSel = brSel.toSource();
    bt.target = "indesign";
    theScript = "var IDsel = app.selection[0]; \n";
    theScript += "if (IDsel instanceof Graphic){ \n";
    theScript += "var theGraphic = IDsel;\n";
    theScript += "}else{\n";
    theScript += "var theGraphic = IDsel.graphics[0];\n";
    theScript += "}\n";
    theScript += "var theFile = File(\""+brSel+"\");\n";
    theScript += "theGraphic.itemLink.relink(theFile);\n";
    theScript += "theGraphic.itemLink.update();\n";
    bt.body=theScript;
    bt.send()
    Thanks,
    Harbs

    Harbs,
    There isn't anything like a scripts palette in Bridge.
    Because your working on a selection, you'll need to add a menu item to bridge.
    You can also navigate to the folder containing the scripts and double click it. But then the script is the selection...
    Bob

  • Trying to link to a zip file from flash

    I am trying to link to a zip file from flash for my users to
    download. I can link to the file fine using get URL. The problem is
    on a PC I am having trouble with the users settings for blocking
    pop ups. If the user clicks one of the two links it works, if they
    then click the other, it blocks the download from happening?
    Works perfect on a MAC.
    Any Suggestions would be greatly appreciated.
    Thanks

    What does your code look like?
    getURL("/yourfile.zip") shouldn't create any pop-ups
    Dan Mode
    *THE online Radio*
    http://www.tornadostream.com
    *Must Read*
    http://www.smithmediafusion.com/blog
    *Flash Helps*
    http://www.smithmediafusion.com/blog/?cat=11
    "kquinn5000" <[email protected]> wrote in
    message
    news:e9ge88$dpo$[email protected]..
    >I am trying to link to a zip file from flash for my users
    to download. I
    >can
    > link to the file fine using get URL. The problem is on a
    PC I am having
    > trouble
    > with the users settings for blocking pop ups. If the
    user clicks one of
    > the two
    > links it works, if they then click the other, it blocks
    the download from
    > happening?
    > Works perfect on a MAC.
    >
    >
    > Any Suggestions would be greatly appreciated.
    > Thanks
    >

  • Creating zip files in pl/sql.

    I'm using code posted on this forum to create zip file in pl/sql. Works greate for combing multiple files into one archive. That's until I have to add a zip file.
    Here's my test:
    drop table t1;
    create table t1 (file_name varchar2(100), file_blob blob);
    declare
    v_new_blob blob;
    v_file_name varchar2(100);
    v_buffer_raw raw(1000);
    v_length integer;
    b_zipped_blob BLOB;
    zip_files zz_zip.file_list;
    t_file blob;
    begin
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('AAAA');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileA.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('BBBBBBBBB');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileB.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('CCCCCCCCCCCCC');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileC.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('DDDDDDDDDDDDDDDDDDDDDDDDDD');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileD.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);     
         commit;
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileA.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileB.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileC.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         zz_zip.finish_zip(b_zipped_blob);
         zip_files := zz_zip.get_file_list( b_zipped_blob );
         for i in zip_files.first() .. zip_files.last
         loop
              dbms_output.put_line( zip_files( i ) );
         end loop;
         dbms_output.put_line('--');      
         -- Output
         FileA.txt
         FileB.txt
         FileC.txt
         -- Save zip in t1
         insert into t1 values ('ZipZZ.zip',b_zipped_blob);
         commit;     
         -- Create new zip file and add ZipZZ.zip and FileD.txt
         b_zipped_blob := null;
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'ZipZZ.zip';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileD.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         zz_zip.finish_zip(b_zipped_blob);
         zip_files := zz_zip.get_file_list( b_zipped_blob );
         for i in zip_files.first() .. zip_files.last
         loop
              dbms_output.put_line( zip_files( i ) );
         end loop;
         dbms_output.put_line('--');      
         /* output
         ZipZZ.zip
         tmp\FileD.txt
         -- save ZipXX.zip
         insert into t1 values ('ZipXX.zip',b_zipped_blob);
         commit;     
    end;
    --Test with other zip files.
    insert into t1 values ('File1.zip',null);
    commit;
    -- I've created a small zip file File1.zip using Winzip. It contains only 1 small text file File1.txt
    -- I use toad to insert into blob column.
    declare
    v_new_blob blob;
    v_file_name varchar2(100);
    v_buffer_raw raw(1000);
    v_length integer;
    b_zipped_blob BLOB;
    zip_files zz_zip.file_list;
    t_file blob;
    begin
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'File1.zip';
         dbms_output.put_line('Blob length: '||dbms_lob.getlength(v_new_blob));
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         zz_zip.finish_zip(b_zipped_blob);
         zip_files := zz_zip.get_file_list( b_zipped_blob );
         for i in zip_files.first() .. zip_files.last
         loop
              dbms_output.put_line( zip_files( i ) );
         end loop;
         dbms_output.put_line('--');
         -- save new file as Zip1.zip
         insert into t1 values ('ZipFF.zip',b_zipped_blob);
         commit;     
    end;      
         Output
         Blob length: 1855
         File1.zip
         File1.txt
    Now, new zip file contains both File1.zip and File.txt.
    My expected result was just File1.zip
    Thanks.

    Your first example looks like I would expect (or do I miss something?).
    Your second example is strange, but it I can't reproduce it. If I zip a zipfile with my package it contains only the zipfile:
    declare
      my_zip blob;
      new_zip blob;
      zip_files as_zip.file_list;
      function file2blob(
        p_dir in varchar2
      , p_file_name in varchar2
        return blob
      is
        file_lob bfile;
        file_blob blob;
      begin
        file_lob := bfilename( p_dir
                             , p_file_name
        dbms_lob.open( file_lob
                     , dbms_lob.file_readonly
        dbms_lob.createtemporary( file_blob
                                , true
        dbms_lob.loadfromfile( file_blob
                             , file_lob
                             , dbms_lob.lobmaxsize
        dbms_lob.close( file_lob );
        return file_blob;
      exception
        when others
        then
          if dbms_lob.isopen( file_lob ) = 1
          then
            dbms_lob.close( file_lob );
          end if;
          if dbms_lob.istemporary( file_blob ) = 1
          then
            dbms_lob.freetemporary( file_blob );
          end if;
          raise;
      end;
    begin
      my_zip := file2blob( 'MY_DIR', 'as_fop.zip' );
      dbms_output.put_line('zip file to start with');
      zip_files := as_zip.get_file_list( my_zip );
      for i in zip_files.first() .. zip_files.last
      loop
        dbms_output.put_line( zip_files( i ) );
      end loop;
      dbms_output.put_line('--');
    --  now create a new zip file containing the existing zip file as_fop.zip
      as_zip.add1file( new_zip, 'as_fop.zip', my_zip );
      as_zip.finish_zip( new_zip );
    --  see what's in the new zip
      dbms_output.put_line('zip file containing a zipfile');
      zip_files := as_zip.get_file_list( new_zip );
      for i in zip_files.first() .. zip_files.last
      loop
        dbms_output.put_line( zip_files( i ) );
      end loop;
      dbms_output.put_line('--');
    end;
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    zip file to start with
    as_fop.sql
    zip file containing a zipfile
    as_fop.zip
    PL/SQL procedure successfully completed.
    ANTON@XE>Anton

  • Create Zip File In Windows and Extract Zip File In Linux

    I had created a zip file (together with directory) under Windows as follow (Code are picked from [http://www.exampledepot.com/egs/java.util.zip/CreateZip.html|http://www.exampledepot.com/egs/java.util.zip/CreateZip.html] ) :
    package sandbox;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    * @author yan-cheng.cheok
    public class Main {
         * @param args the command line arguments
        public static void main(String[] args) {
            // These are the files to include in the ZIP file
            String[] filenames = new String[]{"MyDirectory" + File.separator + "MyFile.txt"};
            // Create a buffer for reading the files
            byte[] buf = new byte[1024];
            try {
                // Create the ZIP file
                String outFilename = "outfile.zip";
                ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
                // Compress the files
                for (int i=0; i<filenames.length; i++) {
                    FileInputStream in = new FileInputStream(filenames);
    // Add ZIP entry to output stream.
    out.putNextEntry(new ZipEntry(filenames[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) {
    e.printStackTrace();
    The newly created zip file can be extracted without problem under Windows, by using  [http://www.exampledepot.com/egs/java.util.zip/GetZip.html|http://www.exampledepot.com/egs/java.util.zip/GetZip.html]
    However, I realize if I extract the newly created zip file under Linux, using modified version of  [http://www.exampledepot.com/egs/java.util.zip/GetZip.html|http://www.exampledepot.com/egs/java.util.zip/GetZip.html] . The original version doesn't check for directory using zipEntry.isDirectory()).public static boolean extractZipFile(File zipFilePath, boolean overwrite) {
    InputStream inputStream = null;
    ZipInputStream zipInputStream = null;
    boolean status = true;
    try {
    inputStream = new FileInputStream(zipFilePath);
    zipInputStream = new ZipInputStream(inputStream);
    final byte[] data = new byte[1024];
    while (true) {
    ZipEntry zipEntry = null;
    FileOutputStream outputStream = null;
    try {
    zipEntry = zipInputStream.getNextEntry();
    if (zipEntry == null) break;
    final String destination = Utils.getUserDataDirectory() + zipEntry.getName();
    if (overwrite == false) {
    if (Utils.isFileOrDirectoryExist(destination)) continue;
    if (zipEntry.isDirectory())
    Utils.createCompleteDirectoryHierarchyIfDoesNotExist(destination);
    else
    final File file = new File(destination);
    // Ensure directory is there before we write the file.
    Utils.createCompleteDirectoryHierarchyIfDoesNotExist(file.getParentFile());
    int size = zipInputStream.read(data);
    if (size > 0) {
    outputStream = new FileOutputStream(destination);
    do {
    outputStream.write(data, 0, size);
    size = zipInputStream.read(data);
    } while(size >= 0);
    catch (IOException exp) {
    log.error(null, exp);
    status = false;
    break;
    finally {
    if (outputStream != null) {
    try {
    outputStream.close();
    catch (IOException exp) {
    log.error(null, exp);
    break;
    if (zipInputStream != null) {
    try {
    zipInputStream.closeEntry();
    catch (IOException exp) {
    log.error(null, exp);
    break;
    } // while(true)
    catch (IOException exp) {
    log.error(null, exp);
    status = false;
    finally {
    if (zipInputStream != null) {
    try {
    zipInputStream.close();
    } catch (IOException ex) {
    log.error(null, ex);
    if (inputStream != null) {
    try {
    inputStream.close();
    } catch (IOException ex) {
    log.error(null, ex);
    return status;
    *"MyDirectory\MyFile.txt" instead of MyFile.txt being placed under folder MyDirectory.*
    I try to solve the problem by changing the zip file creation code to
    +String[] filenames = new String[]{"MyDirectory" + "/" + "MyFile.txt"};+
    But, is this an eligible solution, by hard-coded the seperator? Will it work under Mac OS? (I do not have a Mac to try out)
    p/s To be honest, I do a cross post at  [http://stackoverflow.com/questions/2549766/create-zip-file-in-windows-and-extract-zip-file-in-linux|http://stackoverflow.com/questions/2549766/create-zip-file-in-windows-and-extract-zip-file-in-linux] Just want to get more opinion on this.
    Edited by: yccheok on Apr 26, 2010 11:41 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Your solution lies in the File.separator constant; this constant will contain the path separator that is used by the operating system. No need to hardcode one, Java already has it.
    edit: when it comes to paths by the way, I have the bad habit of always using the front slash ( / ). This will also work under Windows and has the added benefit of not needing to be escaped.

Maybe you are looking for