How to detect opened windows in java
<p>By using the below code I opened a window(say some software installer window) it went fine,
here I want to check weather the window got opened or not.</p>

<p>How to detect whether the window is <em>opened or not</em>?</p>

<p>Code snippet:-</p>

<pre><code>  cmdarray = "......";
  Runtime runTime = Runtime.getRuntime(); 
  Process responce = runTime.exec(cmdarray);
</code></pre>

<p><strong>What kind of Window</strong></p>

<p><strong>Ans</strong>:- Installer anywhere window</p>

<p>At last I able to find the window is opened or not by using the solution provided by Hussain</p>

<p>If I want to close the window, how I can close it.....</p>

<p>I used <strong>taskkill /F /IM &lt;&lt; installer_window>>.exe</strong> command in java(like runtime.exe("command");)to kill the process.
But window is not getting closed. Is there any way to close that window.</p>

<p>Thanks in Advance.</p>

<p><strong>@Hussain</strong></p>

<p>I tried as you said, but I am getting error like <strong>ERROR: The process "proces.exe" with PID 4408 could not be terminated Reason: This process can only be terminated forcefully (with /F option).</strong> thats why I included <strong>/F</strong>, With the help of this I able to kill the process but window is not getting closed.</p>

<p>Please provide a quick solution, waiting for reply....</p>

<p>Thanks in Advance</p>
