aspose file tools
The moose likes Threads and Synchronization and the fly likes Getting a thread to run to completion Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Getting a thread to run to completion" Watch "Getting a thread to run to completion" New topic
Author

Getting a thread to run to completion

Thomas O'Brien
Greenhorn

Joined: May 10, 2000
Posts: 1
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

Joined: Jun 12, 2000
Posts: 118


if u want to finish the current thread to its completion

use thread.join() method



<a href="http://www.jobklub.com" target="_blank" rel="nofollow">http://www.jobklub.com</a><br /> 'Add Job To Life'
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
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){}

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting a thread to run to completion
 
Similar Threads
background threads in tomcat
Thread Scheduling (Multiple CPU)
adding more threads
difference between start() and run() of a thread instance
How to make code execute in its own Thread