Jebbs
Jebbs

Reputation: 58

How to track down seemingly random crashes in Java?

While doing some homework that works with some swing gui components, my program started crashing seemingly at random. That is, it starts, runs for a short time, and then crashes. I don't get any errors in the console, it's just a straight up crash.

I don't doubt that it is something I wrote, and I'm more than happy to show code if anyone wants to look at it, but is there anything that I can do myself to track down what might be the cause of my crashes?

Some other information that might be useful:

Upvotes: 2

Views: 741

Answers (1)

trashgod
trashgod

Reputation: 205795

Some possible heuristics:

  • Crashes that occur seemingly at random suggest incorrect synchronization; look for event dispatch thread violation using one of the approaches cited here.

  • Verify that all exception handlers produce diagnostic output; run from the command line to ensure that diagnostic output has not been inadvertently redirected.

  • Try running under the aegis of a different debugger, e.g. NetBeans.

  • Try running under the aegis of a profiler.

  • Try a different version of the JDK/JRE.

  • Try a different host OS.

Upvotes: 2

Related Questions