Strange problem in java

Hi,

I have a following program , this program call another classes .

my problem is that if I run loop to call the other classes, for example:

for (int i =3;i<=4;i++), I get a strange error saying :

java.io.FileNotFoundException: dataf\iris\TrainingData.txt (Access is denied)

But when I run the program for every single iteration for example

for (int i =1;i<=1;i++), :

run again

for (int i =2;i<=2;i++), :

run again

for (int i =3;i<=3;i++), :

........

until for (int i =10;i<=10;i++), :

I get correct results, no problem in that.

But,

I need 10 iteration for this code so, it is not convenient for every run to do it like this:

for (int i =1;i<=1;i++), :

run again

for (int i =2;i<=2;i++), :

run again

for (int i =3;i<=3;i++), :

........

until for (int i =10;i<=10;i++), :

This gives correct results but as I mentioned this is not good coding, is there anyway to avoid that ?

I just need to run my program once :

like this :

for (int i =1;i<=10;i++), :

My code is attached under"

publicclass RunAllPrograms{

staticdouble [] AccuracyCal =newdouble [10];

staticdouble [] ErrorCal =newdouble [10];

publicstaticvoid main(String[] args)throws IOException{

// TestKillProcess J= new TestKillProcess();

String Rel = JOptionPane.showInputDialog ("Enter Relation name : ");

for (int i =3;i<=4;i++){

RunAllPrograms Y =new RunAllPrograms();

Y.deleteFile ("dataf/"+Rel+"/ProftFileClassification.txt");

Y.deleteFile ("dataf/"+Rel+"/plength.txt");

Y.deleteFile ("dataf/"+Rel+"/pwidth.txt");

Y.deleteFile ("dataf/"+Rel+"/slength.txt");

Y.deleteFile ("dataf/"+Rel+"/swidth.txt");

Y.deleteFile ("dataf/"+Rel+"/TrainingData.txt");

Y.deleteFile ("dataf/"+Rel+"/TestingData.txt");

Feras_SplitTrainingAndTesting A =new Feras_SplitTrainingAndTesting();

SplitAtributes B =new SplitAtributes();

FerasPrgMain C =new FerasPrgMain();

Statistics D =new Statistics();

FerasID3 E =new FerasID3();

SortClassification F =new SortClassification();

Prototypes G =new Prototypes();

Proaftn3 H =new Proaftn3();

Accuracy I =new Accuracy();

A.Start1(Rel,i);

B.Start2(Rel);

C.Start3(Rel);

D.Start4(Rel);

E.Start5(Rel);

F.Start6(Rel);

G.Start7(Rel);

H.Start8(Rel);

I.Start9(Rel);

AccuracyCal[i-1] = I.AccuracyVal;

ErrorCal[i-1]= I.ErrorVal;

Write( i, AccuracyCal[i-1] );

System.out.println(" Accuracy = "+ I.AccuracyVal +" %");

System.out.println(" Error rate = "+ I.ErrorVal +" %");

}// end for

double sum1=0, sum2=0;

for (int j= 0; j<AccuracyCal.length; j++){

sum1 = sum1+ AccuracyCal[j];

sum2 = sum2+ ErrorCal[j];

}

System.out.println(" Average Accuracy = "+ sum1/AccuracyCal.length +" %");

System.out.println(" Average Error rate = "+ sum1/ErrorCal.length +" %");

}

publicstaticvoid deleteFile (String DelFile )

{

File myFile =new File(DelFile);

try

{

myFile.delete();

// System.out.println("Successfully deleted " + myFile.toString());

}

catch (SecurityException e)

{

System.out.println("Caught security exception trying to delete file " + myFile.toString());

}

}

publicstaticvoid Write(int x,double Results )throws IOException

{

DecimalFormat myDecFormat =new DecimalFormat("####.00");

File appending =new File("RessultsNow.txt");// Prototype file name

FileWriter appendingW =new FileWriter(appending,true);

BufferedWriter StartAppend =new BufferedWriter(appendingW);

StartAppend.write(x+"\t"+Results);

StartAppend.newLine();

StartAppend.close();

}

}>

[6749 byte] By [FNOa] at [2007-11-27 6:21:36]
# 1
STOP POSTING THE SAME THING OVER AND OVER. YOU'RE GETTING HELP IN ONE OF YOUR OTHER THREADS. KEEP IT THERE.
jverda at 2007-7-12 17:38:11 > top of Java-index,Java Essentials,Java Programming...