pls help me?

hello friends

i am new to java

i am unable to zip the files in my directory by using this program

import java.io.*;

import java.util.zip.*;

public class Zip {

static final int BUFFER = 2048;

public static void main (String argv[]) {

try {

BufferedInputStream origin = null;

FileOutputStream dest = new

FileOutputStream("c:\\zip\\myfigs.zip");

ZipOutputStream out = new ZipOutputStream(new

BufferedOutputStream(dest));

//out.setMethod(ZipOutputStream.DEFLATED);

byte data[] = new byte[BUFFER];

// get a list of files from current directory

File f = new File("."); String files[] = f.list();

for (int i=0; i<files.length; i++) {

System.out.println("Adding: "+files);

FileInputStream fi = new

FileInputStream(files);

origin = new

BufferedInputStream(fi, BUFFER);

ZipEntry entry = new ZipEntry(files);

out.putNextEntry(entry);

int count;

while((count = origin.read(data, 0,

BUFFER)) != -1) {

out.write(data, 0, count);

}

origin.close();

}

out.close();

} catch(Exception e) {

e.printStackTrace();

}

}

}

but it is working fine for compress the files in the current directory

but

File f = new File("C:\\ramu");

it shows the error like this

C:\j2sdk1.4.2_09\bin>javac Zip.java

C:\j2sdk1.4.2_09\bin>java Zip

Adding: okh.txt

java.io.FileNotFoundException: C:\ramu (Access is denied)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.<init>(FileInputStream.java:106)

at java.io.FileInputStream.<init>(FileInputStream.java:66)

at Zip.main(Zip.java:21)

can any body help to rectify this problem

[1897 byte] By [jesus789a] at [2007-11-27 7:47:23]
# 1

Don't cross post!

http://forum.java.sun.com/thread.jspa?threadID=5184841&tstart=0

And use code tags already.

The referenced thread already has advice for you (and no, we will not do it for you, you've already been given an example of how to do it, it is up to you to at least attempt it).

masijade.a at 2007-7-12 19:28:29 > top of Java-index,Java Essentials,New To Java...