Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

JAVAW Hell

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry i'm actually using System.exit(0)...
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I am displeased. You are no longer allowed to read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic