• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Bug Squashing Tactics ...

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
I have made a GUI program that is called from native code. Basically the GUI runs as a screensaver. When the GUI is single-threaded (i.e. the GUI Thread only) the program runs flawlessly. However when I make it multi-threaded after a while the screensaver stops running and when I hit alt-ctrl-del I see that I have one or more Java tasks running in the background. So obviously something is wrong with my threading. I am having a heck of a time tracking the progress of the Java code since when the code is called from the native code, there is NO command prompt window and hence I can�t do the standard: System.out.println(�Executing X_Routine�), trick for debugging. I tried using a text file log, but if the program crashes before it closes the log, then I don�t get any debugging info. So I guess my two main questions are the following -
1) What is the best way to track down errors in such a situation.
2) I really, REALLY miss having output automatically directed to the command prompt window. Is there anyway that I can force this?
Thanks in advance
Dan
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Log4J to the rescue, I'd think. Or, more low tech, flush() your debugging file after every write; a PrintStream or PrintWriter with autoFlush set to true should do.
- Peter
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic