I can read but not write to an Excel file!

Hello,

I hope someone can help me witht this. I am writing a program that reads and writes to an Excel file with the use of Jakarta's HSSF.

I can read the excel file with no problems, but when it comes to writing on it it only works the first time! Then when i try again, I get this:

java.io.FileNotFoundException: N:\Servers.xls (Access is denied)

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

at java.io.FileOutputStream.<init>(Unknown Source)

at java.io.FileOutputStream.<init>(Unknown Source)

On some PCs i have no problems, but on others it works only once and then I get the above error. I am using Java 1.5.0. Thanks.

Message was edited by:

nnt01

[725 byte] By [nnt01a] at [2007-11-27 11:47:13]
# 1

did u check the access permissions of the file?

java_jamboreea at 2007-7-29 18:11:55 > top of Java-index,Java Essentials,Java Programming...
# 2

if u r reading by using FileInputStream then close it's object before u write to it

FIS.close();

then write to it

AmitChalwade123456a at 2007-7-29 18:11:55 > top of Java-index,Java Essentials,Java Programming...
# 3

ya..evrything is fine..my program even creates that file

I was doing some searching, is it true that this is a bug in Java..because I can't understand how sometimes it works and sometimes it doesn't

nnt01a at 2007-7-29 18:11:55 > top of Java-index,Java Essentials,Java Programming...
# 4

> if u r reading by using FileInputStream then close

> it's object before u write to it

>

> FIS.close();

> then write to it

Thanks, I think It worked!

nnt01a at 2007-7-29 18:11:55 > top of Java-index,Java Essentials,Java Programming...