javaw.exe proccess

P

patrick

Ive got a java swing application with many classes,
TimerListener's,Timer's, reads and writes to many files.

The problem is that when I close the application there is still a javaw.exe
process running everytime.which I delete manually. Obviously some thread
which is not killed off.

I dont know where to look to find the source of this.
Is there a way of narrowing down the source of the problem??

TIA
patrick
 
S

Steve Horsley

patrick said:
Ive got a java swing application with many classes,
TimerListener's,Timer's, reads and writes to many files.

The problem is that when I close the application there is still a javaw.exe
process running everytime.which I delete manually. Obviously some thread
which is not killed off.

I dont know where to look to find the source of this.
Is there a way of narrowing down the source of the problem??

TIA
patrick
You could arrange for the app to call System.exit(int) when you have
finished.

Or call JFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Steve
 
T

Tony Morris

I dont know where to look to find the source of this.
Is there a way of narrowing down the source of the problem??

You have non-daemon threads running.
Find them with a profiler.
Prevent them from running indefinitely with correct application logic.

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 
T

Thomas Weidenfeller

Roedy said:

The order of events you list under "Final Close" is IMHO wrong.

Calling dispose() should be the last, not the first action. One should
first remove the frame from all Collections and events it has subscribed
to (just a special kind of collection for this case). Usually you want
to give your data model(s) a good look. You should also get rid of all
other references (this is the moment when a programmer recognizes that
it was maybe not a good idea to distribute the reference to everyone and
it's dog in then program :))

That way you can avoid having another thread (there should be none, but
messing up Swing thread handling is common ...) resurrecting the frame
via a setVisible(true) after you called dispose().

Getting the frame out of every Container is not necessary, since you
can't put a frame in a Container :).

For immediate user feedback it is maybe a good idea to first call
setVisible(false), then do the cleanup, then call dispose().


/Thomas
 
S

Stefan Poehn

patrick said:
Ive got a java swing application with many classes,
TimerListener's,Timer's, reads and writes to many files.

The problem is that when I close the application there is still a javaw.exe
process running everytime.which I delete manually. Obviously some thread
which is not killed off.

I dont know where to look to find the source of this.
Is there a way of narrowing down the source of the problem??

Start your java app with java.exe (not javaw.exe) and press
Ctrl+Shift+Break. You will get a listing of all threads on the console.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top