Waiting in main until a thread finishes.
Posted on 2004-04-14
I start a thread from my main class (which is a GUI/JFrame) to read a text file and doing some work on the read in data. How can I pause the main program until the thread finishes its work and returns?
I tried wait()/notify but I alway get a java.lang.IllegalMonitorStateException: current thread not owner
I even tried to join the working thread: mainClass.join(); but then my app freezes.