running batch file error

I have already tried to find some solution on Java Essential forum, not much success there. I hope someone might suggest something here.

Design: one big file, split into chunks, recombined according to some order, feeded to some exe file, and finally compilation of results.

Problem: I can run that smoothly with jdk, however, when I use Java beans I am running into troubles. I can split the file, create an order, recombine the files, but when I try to feed it to an exe file(through a batch file) i get this error:

endfile record was detected in a READ statement (UNIT = 3). Error occurs at _MAIN__. A dubplicate file name exists or the file cannot be found

The main method is something like this:

s.split_ftn07() ;

s.Define_Order() ;

for (int i = 1 ; i < 11 ; i ++)

{

s.re_combine(i) ;

s.run_Fastran(i) ;

}

s.ass_Result() ;

my batch file:

@echo off

cd

"C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"

ren FTN04 FTN04i

:finish

and my method that runs the batch file: (as soon as it pass the exec(), it opens the cmd.exe windows and displays the error message).

publicvoid run_Fastran(int x)

{

try

{

File ftn07_i =new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;

File ftn07 =new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;

ftn07_i.renameTo(ftn07) ;

String path ="";

path ="cmd /c start C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FCall.bat";

Runtime rt = Runtime.getRuntime();

Process proc = rt.exec(path);

String nameNew ="C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04-" + x +"-p12";//change p12 with the crack path input by user.

File file =new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04i");

while (file.exists()==false)//until FTNO4i come into existence

{

}

// File with new name

File file2 =new File(nameNew);

// Rename file

file.renameTo(file2);

File ftn07Back =new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;

File ftn07_iBack =new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;

ftn07Back.renameTo(ftn07_iBack) ;

File ftn07_i_del =new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;

ftn07_i_del.delete() ;

}

catch(Exception e)

{

e.printStackTrace();

}

}

I am tired to figure out whats going on? Need some help here, will be greatly appreciated. Thanks

[3758 byte] By [NasirMunira] at [2007-11-26 20:16:54]
# 1
any help ?
NasirMunira at 2007-7-10 0:39:48 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

Thanks to all, I really appreciate all the pains which all of you have taken in resolving my problem.

It wasn't Java problem, rather batch file problem. I was only changing the directory, and was not providing for the exe file to run.

@echo off

cd "C:\JBoss\jboss-4.0.5.GA\bin\Fastran"

"C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"

ren FTN04 FTN04i

EXIT

:finish

Now it is working fine.

I did check the access permissions, no problem with that I guess. The problem was with the path. The batch file couldnt go pass bin directory, and I noticed that only today ;(. At any rate, I changed that and now it is all smooth and dandy.

Once again, thanks a lot.

NasirMunira at 2007-7-10 0:39:48 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...