• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting a thread to run to completion  RSS feed

 
Thomas O'Brien
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to start a VB .exe (in a thread), and have it run to completetion exclusively. Is there any to do this? So, I basically want the code to pause while this executable runs. Thanks for the help.
 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


if u want to finish the current thread to its completion

use thread.join() method

 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This actually looks to me to be a job for RunTime exec method.
A program like the following should work
String s;
int len;
byte[] buf = new byte[1000];
Process proc;
InputStream inDat InputStream inErr
try{
proc = Runtime.getRuntime().exec("<your vb program here>");
inErr = proc.getInputStream();
inDat = proc.getInputStream();
while((len=inDat.read(buf) > 0)
{
s = new String(buf,0,len); // do what you want with s
}
proc.waitFor();
}
catch(IOException e){}
}catch(InterruptedException ie){}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!