Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to implement Queue in Java?
    primarykey
    data
    text
    <p>I have a folder with 1 <code>ThMapInfratab1-2.exe</code> file and 3 <code>.txt</code> files. If you run <code>.exe</code> file in any way(through command prompt,just double click and through any language) one Icon will be appear on <code>Taskbar</code>.</p> <p><img src="https://i.stack.imgur.com/nDhRm.jpg" alt="enter image description here"></p> <p>My <code>.exe</code> will be run 2-3 minutes.</p> <p>Know I want to run these <code>.exe</code> file using <code>Java</code>.I found How to run <code>.exe</code> from <code>Java</code> technology.</p> <p>My concept was, first I will find <code>.txt</code> file Names from the directory.finally I will get like this.</p> <pre><code>List&lt;File&gt; fileNames={"File1.txt","File2.txt","File3.txt"}; </code></pre> <p>Know I want to run my <code>.exe</code> file 3 times because my <code>fileNames</code> length is equals to <code>3</code>.For this I wrote the following code.</p> <pre><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 &lt; fileNames.size(); fileIndex++) { ExternalFileExecutionsObject.ExeternalFileProcessing("C:/Users/Infratab Bangalore/Desktop/Rod","ThMapInfratab1-2.exe",fileNames[fileIndex ]); } } </code></pre> <p>I evaluated above code, at a time 3 <code>.exe</code> processes are started.But I don't want like that. I want to run <code>.exe</code> file one by one(we need to monitor, whether the previous <code>.exe</code> process was done or not. once it's done it allows to next Iteration).</p> <p>I tried with <code>Wait()</code>.but it's not working.</p> <p>I guess, for this I need to add some code in my <code>ExeternalFileProcessing()</code>. But I didn't get anything.</p> <p>can anyone suggest me.</p> <p>I hope, you understand, what My problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload