• Post Reply Bookmark Topic Watch Topic
  • New Topic

JAVAW Hell  RSS feed

 
Eddie Long
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Eclipse to learn swing programming. After a few runs of the program I got an out of memory error! Felt quite good cos i'd never got a java error in my program before but i hope it's not a sign of things to come.
While investigating the reason for the error i found that there were 18 javaw.exe processes running in the background - (i'm using windows by the way). Everytime i start my program one more is added and when i close the program this process is not killed even though i use System.exit() in my Windowclosing listener.
i presume it's some sort of memory leak but how do i stop it? Is my hypothesis right? what is javaw?
 
Tony Fabeets
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
found on java.sun.com:
The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason.
try a System.exit(0)
 
Eddie Long
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i'm actually using System.exit(0)...
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you using System.exit( 0 )? The only reason I've seen Eclipse "hang" javaw calls is when the JVM is still running. Are you calling System.exit() inside the windowClosing() method of a WindowListener attached to your window? The default close operation (unless you set it yourself) is just to hide the frame on close, which leaves the JVM running.

Either call setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ) on your JFrame and don't do the listener yourself, or double check the listener to make sure it's actually attached to the JFrame. Also, if you are extending WindowAdapter make sure the windowClosing method signiture matches exactly or you aren't actually overriding it.
 
Brian Pipa
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'd never got a java error in my program before but I hope it's not a sign of things to come

Errors/exceptions are quite common while writing and debugging code. Don't get upset if you come across them
Brian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!