Hi,
* This is my code ...........
* In the below code for loop is executed before the .bat file, so that i gave
this.wait() and notify() method , it waits for long time and it doesn't execute the for loop ,it will execute only .bat and it wait for notify the thread.......
* this.notify() is not execute for the below code.....
* Tell me suggestion for the below code and how solve it.........
CODE
public class Waitfor
{
public synchronized void work(){
try
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("cmd /c start D:\\test.bat");
this.wait();
this.notify();
for(int i=0; i<6; i++ ){
System.out.println(i);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
Waitfor w=new Waitfor();
w.work();
}
}
Thanks
J.Imran