• Post Reply Bookmark Topic Watch Topic
  • New Topic

why does not my java program quit  RSS feed

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I wrote a java program, having NO UI, NO thread, however, it does not quit after main() returns. This suggests that there is another thread running, but I could not think of anything else being running.
What would I be looking for to fix this other than using System.exit()?
Thanks.
Yan
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I take it you don't create/start any threads in your program and have inserted a System.out.println( "exiting" ) statement as the last line of your main method to verify completion, but it doesn't print?
I'd guess you have an infinite loop.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without seeing your code, I don't have a good guess. Some GUI code could certainly cause a situation as you've described, but you said you didn't have any.
A call to System.exit(int) should certainly kill everything.
If you're more interested in discovering the suspect, let's continue the conversation in the Intermediate forum...
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you know your main returns?
Most likely it's just sitting there, waiting for something to happen or locked in an eternal loop.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the code to better understand the situation. Have you used any loop in main? May be you are using an infinite loop.
 
Gerome Kawa
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post your code so we can have a look.
It could be an infineite loop or expecting user inputs!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!