How to zip a file?

Hi folks...
I need to zip a file from Oracle Forms 6i (Oracle EBS 11.5.2.10) or a PL/SQL object to send it by e-mail.
I did a search and the only solution that I found was using Java:
*1) Create a java file like:*
import java.util.zip.*;
import java.io.*;
public class zipfile
public boolean addFile(String filename,String outFilename)
try {
int len;
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
FileInputStream in = new FileInputStream(filename);
// Add ZIP entry to output stream.
out.putNextEntry(new ZipEntry(filename));
byte[] buf = new byte[1024];
while ((len = in.read(buf)) > 0)
out.write(buf, 0, len);
in.close();
out.closeEntry();
out.close();
return true;
} catch (IOException e)
return false;
*2) Compile this file and import it at Oracle forms using Import Java Classes. But when I try to import this file I get the following error:*
Importing Class Zipfile...
Exception occurred: java.lang.UnsupportedClassVersionError: Zipfile (Unsupported major.minor version 50.0)
What can be? Other Ideas to zip a file using Forms or PL/SQL?
tks

This might work, but you have to compile it with an older version of the java-compiler than you do. You might try JDeveloper 9.x which comes with the developersuite10g, but it might also be that you have to use an even older version.

Similar Messages

  • How to zip multi files into one zip file in ABAP

    hi all:
    As you know, ABAP has CL_ABAP_GZIP class to support zip file function. But it only support one file zip. If I want to zip two files into one zip file, how to do it?
    thanks.

    Hi,
    <li>If you know how to zip one file,  to zip two files , you can follow the below steps.
    DATA:g_zipper     TYPE REF TO cl_abap_zip.
    "create our zipper object
    CREATE OBJECT g_zipper.
    "add 1st file to zip
    CALL METHOD g_zipper->add
       EXPORTING
         name    = file_name
         content = content_x.
      "add 2nd file to zip
    CALL METHOD g_zipper->add
       EXPORTING
         name    = file_name
         content = content_y.
    "save zip
    CALL METHOD g_zipper->save
       RECEIVING
         zip = zip.
    Thanks
    Venkat.O

  • 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

  • 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");
    }

  • How to ZIP the files and folders/sub folder files using java

    HI All,
    I'm New to this Forum, Could anybody tell me how to zip the files and folders/sub folders using java. For example I have a folder with the name testfolder and side that folder I have some files and some sub folders inside subfolders I have some other files. I need to ZIP the files and folders as they are in same hierarchy.
    Any pointers or help wolud be appritiated.
    Thanks,
    Rajeshbabu V

    [http://www.devx.com/tips/Tip/14049]

  • How to zip a file on mac pro?

    how to zip a file on mac pro?

    Tristan,
    Select multiple items that you want to zip, right click and choose "Compress XX Items."

  • How to Zip server files(in a directory) and throwing back to client

    Can someone tell me how to zip all the files in a particular directory of my web application and throwing back to client to give option for save that zipped file.
    i have used the below used function to zip in servlet. But I cann't zip a particular directory of my application in server.
    Please help
    private void zipDir(String dir2zip, ZipOutputStream zos)
    try
    //create a new File object based on the directory we
    // have to zip File
    File fileDir2Zip = new File(dir2zip);
    System.out.println("is directory ..."+fileDir2Zip.isDirectory());
    //get a listing of the directory content
    String[] dirList = fileDir2Zip.list();
    for(int i = 0 ; i < dirList.length ; i++)
    System.out.println("Dir list ..."+dirList);
    byte[] readBuffer = new byte[2156];
    int bytesIn = 0;
    //loop through dirList, and zip the files
    for(int i=0; i<dirList.length; i++)
    File f = new File(fileDir2Zip, dirList[i]);
    if(f.isDirectory())
    //if the File object is a directory, call this
    //function again to add its content recursively
    String filePath = f.getPath();
    zipDir(filePath, zos);
    //loop again
    continue;
    //if we reached here, the File object f was not
    //a directory
    //create a FileInputStream on top of f
    FileInputStream fis = new FileInputStream(f);
    //create a new zip entry
    ZipEntry anEntry = new ZipEntry(f.getPath());
    //place the zip entry in the ZipOutputStream object
    zos.putNextEntry(anEntry);
    //now write the content of the file to the ZipOutputStream
    while((bytesIn = fis.read(readBuffer)) != -1)
    zos.write(readBuffer, 0, bytesIn);
    System.out.println("Last");
    //close the Stream
    fis.close();
    catch(Exception e)
    e.printStackTrace();

    Hi
    Whatever file exist in directory should execute with out any condition because they delete all files after exection of my process chain. They are using another process chain once a day for deletion of all files in that directory.
    So directory always contains fresh files.
    Here by using routine in infopackge i am unable to run all files one by one at a time.
    As of my knowledge  by using infopackage we can run only one file at a time.
    Here my question is , can we run more than one file in single run of infopackage?
    or can we have any function module to run the infopackage from externally? so that i can use function module in abap program? any ideas..
    Regards
    Raju

  • How to zip keynote files?

    How to Zip or Reduce Keynote Files?

    Newer versions of Keynote zip the documents as part of the save process by default; these files can't be compressed much further without losing content. To check, control-click the document in the Finder and see if Show Package Contents is an option; if not, it's already zipped. If it is, choose to compress or archive it from that menu.
    (63532)

  • How to Zip a file and find it size using ABAP code

    Hi All,
    My requirement is to extract a file from Al11 ZIP it and find it size. 
    Please let me know whether there are any Function modules or Classes for Zipping and finding the size of it.
    Note : Used Class "cl_abap_zip" but the output at in chinese language.
    Thanks in advancve for your support.
    Regards
    Jithu

    Check https://wiki.sdn.sap.com/wiki/display/profile/GZIP
    and how to zip and unzip a file in abap
    May it useful
    Kanagaraja L

  • How to ZIP, PDF file attachment

    Hi,
    I have an ABAP report requirement to send an email to a user. This program will send an email with PDF attachement. However, the PDF attachment is quite big (9MB) and our email server couldn't handle it (5MB only). Is there any way to ZIP this PDF file attachment?
    I am using a SAP release ECC 6.0with OS WinNT. And the ABAP program should be able to run in Foreground/Background.
    Thanks for your help in advance...

    Hi,
    Try this code:
    data ca_attach_zip(22)     TYPE c VALUE 'Attch.',
    OPEN DATASET va_filename_zip  FOR INPUT  IN BINARY MODE.
       DO.
         READ DATASET va_filename_zip INTO objbin.
         IF sy-subrc NE 0. EXIT. ENDIF.
         APPEND objbin.
       ENDDO.
        APPEND objbin.
      DESCRIBE TABLE objbin LINES tab_lines.
       CLOSE  DATASET va_filename_zip.
        DELETE DATASET va_filename.
        DELETE DATASET va_filename_zip.
        DESCRIBE TABLE objbin LINES tab_lines.
        objhead = ca_attach_zip.
        APPEND objhead.
    ***Creation of the entry for the compressed attachment
       objpack-transf_bin = 'X'.
        objpack-head_start = 1.
      objpack-head_num = 1.
        objpack-body_start = 1.
        objpack-body_num = tab_lines.
       objpack-doc_type = ca_zip.
       objpack-obj_name  = ca_attach_zip.
      objpack-obj_descr = ca_attach_zip.
       objpack-doc_size = tab_lines * ca_255.
        APPEND objpack.
    *** Completing the recipient list
        reclist-receiver = va_mail_address.
        reclist-express  = 'X'.
        reclist-rec_type = 'U'.
        APPEND reclist.
    *** Sending the document
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
           document_data              = doc_chng
           put_in_outbox              = ca_x
            commit_work                = 'X'
          TABLES
           packing_list               = objpack
            object_header              = objhead
            contents_bin               = objbin
            contents_txt               = objtxt
            receivers                  = reclist
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
           operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
    You have to load your file in the contents_bin table of FM.
    You can load the file by OPEN DATASET and the READ DATASET command.
    In the object_header you can put some description.
    For your info:
    1. Zip the data and send as an email attachment
    2. How to Zip the data in an internal table
    3. Re: How to ZIP a PDF file email attachment
    May it helps you.
    Regards.
    Deepak Sharma.

  • How to zip a file in abap

    Hi folks,
    plz help me out with the code to zip a file .I have  a zip a file...Kindly help me out...I tried with ws_execute but unable to do ....
    Regards,
    Raj

    Hi,
    have a look at this:
    abap gzip zip
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/gzip
    Best regards.
    Edited by: pablo casamayor on Mar 31, 2008 3:18 PM

  • How to ZIP a File from File adapter

    Hi All,
    How Can I create a ZIP file after reading from the directory.
    Is there any property which zip's all the read file?
    The requirement is to read an xml and create a zip of the same file in different location. Appreciate your response.
    Thanks,

    Hi,
    You can use OOTB Pipelines and Valves to achieve this. Refer below and let us know if you have any questions.
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#autoId19
    Regards,
    Neeraj Sehgal

  • I don't know how to zip a file. Help please.

    I am trying to send an attachment with an email. The attachment is too big and my email program won't send it. I want to zip the attachment to make it smaller. How do I do this? Thanks very much.

    Be aware if you try to compress media files or images then you probably won't be able to reduce the size much as such files do not compress very well.
    In such a case it is better to upload the file to one of the many available file hosting sites and send the links instead.
    * https://www.yousendit.com/
    * http://www.snapdrive.net/
    * http://www.imageshack.us/

  • How create .ZIP, .RAR file on data export

    Dear All(s)
    On export in want to create .DMP and .RAR,ZIP files, How i can do this in Oracle 10.2.0.1
    EXP full=Y file=d:\abc.dmp
    Thanks in Advance

    For Linux, you can create shell script to export database and after that create .tar file from exported dump
    On Windows, you can create bat file to run export and then zip the dump file automatically
    On my blog, you can see an example of this procedure
    http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • How to zip multiple files using plsql

    Hi All,
    I have created a group of files using utl_file and stored in a specific directory.
    I want to zip them all so that i can send it throug email.
    Could you please help me to write a pl sql program which can do the above.
    Thanks
    Kiran

    Hello Kiran,
    you posted this question before {thread:id=2248112} and got some answers. Did you follow the links? If you have still questions then please use the original thread.
    Regards
    Marcus

Maybe you are looking for

  • Flash based photo galleries won't play

    Photos on my website have stopped working, The website was built using NetObjects Fusion XII on Windows 7 (64 bit) and the photo galleries use shockwaveflash. I have checked the addons and plugins and everything is up to date. I have re-installed fla

  • Going to next page in smartform

    Dear friends, I need ur help solving a problem in smartform. I need to add a new page and the first page should goto the next page (page2) on a condition. 1. I created a new page (page2) 2. In first page (in PAGE1 properties) I assigned PAGE2 as next

  • Send java mail throws KM - problems sendMail

    Hellow I implementing the Java send mail post in send mail throws NoClassDefFoundError: javax/mail/MessagingE But I have a little problem with the sentence: <b>sendMailSvc.sendMail(mailItem, iuser);</b> The stranger is that NetWeaver protests to me t

  • User defined fields in XL Reporter

    Hi I'm using SAP Business One 2007B PL:4, I cant able to enable User defined fields in XL-Reporter. How to enable this. Kindly help me in this. Awaiting for your response. Thanking You Best Regards, Gayathri.P

  • View of Component Is Not Visible. Navigation Is Not Possible

    Hi All, I have copied Window1 into Window2 and when I try to navigate from view1 to view2 in the copied window(window2),the dump "View of Component Is Not Visible. Navigation Is Not Possible " is thrown. I have tried recreating the navigation links i