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

