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