public void makeZIP(String s_zipPath,
                        String s_newZipFile,
                        String s_fileName,
                        String s_filePath,
                        String status,
                        String yearmonth)
                        throws FileNotFoundException,IOException
    {
        try
        {
            File f_compressFile=new File(s_filePath,s_fileName);
            if (f_compressFile.isFile())
            {
                FileInputStream s_fileIn=new FileInputStream(f_compressFile);
                DataInputStream in = new DataInputStream(s_fileIn);
                outZip.putNextEntry(new ZipEntry(s_fileName));                int c;
                while((c = in.read()) != -1)
                   outZip.write(c);
                in.close();
                s_fileIn.close();
                outZip.closeEntry();
                java.io.File ZipfileDir = new java.io.File(s_filePath+"\\"+s_fileName);
                if (ZipfileDir.exists())
                {
                    ZipfileDir.delete();
                }
                if (status=="end")
                {
                  outZip.close();                  this.addNormalMessage("Download/"+
                      this.getSessionParam().getString(
                      CMN_APP_ColConstant.MANNO)+"_"+yearmonth+".zip");                }
               }
            else if (f_compressFile.isDirectory())
            {
                File f_zip=new File(s_zipPath,s_newZipFile);
                FileOutputStream f_zipFile = new FileOutputStream(f_zip);
                outZip = new ZipOutputStream(new DataOutputStream(f_zipFile));
                String[] s_fileList=f_compressFile.list();
                String s_newDirectory=f_compressFile.getAbsolutePath();
                String nowStatus=null;
                for (int i=0;i<s_fileList.length ;i++ )
                {
                  if (i==s_fileList.length-1)
                  {
                    nowStatus="end";
                  }
                  makeZIP(s_zipPath,s_newZipFile,s_fileList[i],
                      s_newDirectory,nowStatus,yearmonth);
                }
            }
            //
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
    }
这是别人写的压缩方法,你参考一下吧!!!!