I have a folder with 1 ThMapInfratab1-2.exe file and 3 .txt files. If you run .exe file in any way(through command prompt,just double click and through any language) one Icon will be appear on Taskbar.

My .exe will be run 2-3 minutes.
Know I want to run these .exe file using Java.I found How to run .exe from Java technology.
My concept was, first I will find .txt file Names from the directory.finally I will get like this.
List<File> fileNames={"File1.txt","File2.txt","File3.txt"};
Know I want to run my .exe file 3 times because my fileNames length is equals to 3.For this I wrote the following code.
//ExeFileProcess Function
public void ExeternalFileProcessing(String DirectoryPath,String exeFileName,String inputFileName) throws IOException
{
String executableFileName = DirectoryPath+"/"+exeFileName;
String inputFile=inputFileName;
ProcessBuilder processBuilderObject=new ProcessBuilder(executableFileName,inputFile);
File absoluteDirectory = new File(DirectoryPath);
processBuilderObject.directory(absoluteDirectory);
processBuilderObject.start();
//processBuilderObject.wait();
}
//Main Function code.
public static void main(String[] args) throws IOException
{
ExternalFileExecutions ExternalFileExecutionsObject=new ExternalFileExecutions();
for (int fileIndex = 0; fileIndex < fileNames.size(); fileIndex++)
{
ExternalFileExecutionsObject.ExeternalFileProcessing("C:/Users/Infratab Bangalore/Desktop/Rod","ThMapInfratab1-2.exe",fileNames[fileIndex ]);
}
}
I evaluated above code, at a time 3 .exe processes are started.But I don't want like that. I want to run .exe file one by one(we need to monitor, whether the previous .exe process was done or not. once it's done it allows to next Iteration).
I tried with Wait().but it's not working.
I guess, for this I need to add some code in my ExeternalFileProcessing(). But I didn't get anything.
can anyone suggest me.
I hope, you understand, what My problem.
Java.so I divided my problem into function wise and I am trying to figure it out. But in every function I stuck in somewhere, I am asking help fromStackoverFlowguys.because these guys are ready to help to anyone(even for starting guys). Finally I reached final stage of my problem. for this I am working from yesterday. because everytime, I don't want to base on any one. so first I am trying using Google, If I face any problem I am posting question inStackoverFlow.