如何在 Java 中追踪看似随机的崩溃? [英] How to track down seemingly random crashes in Java?

查看:32
本文介绍了如何在 Java 中追踪看似随机的崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在做一些使用一些 Swing gui 组件的作业时,我的程序似乎是随机开始崩溃的.也就是说,它启动,运行一小段时间,然后崩溃.我在控制台中没有收到任何错误,这只是直接崩溃.

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:

  • 我正在使用 Eclipse,调试器似乎没有做任何可以帮助我解决这个问题的事情(程序仍然崩溃).
  • 在开始添加事件处理之前,我没有注意到任何此类问题.
  • 我使用的是 Windows 10.
  • 有时,我创建的窗口中没有绘制任何内容.退出然后再次运行程序将使其工作.

推荐答案

一些可能的启发:

  • 崩溃似乎是随机发生的表明同步不正确;寻找事件调度线程使用此处引用的方法之一进行违规.

  • 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.

尝试在不同调试器的支持下运行,例如NetBeans.

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

尝试在分析器的支持下运行.

尝试不同版本的 JDK/JRE.

Try a different version of the JDK/JRE.

尝试不同的主机操作系统.

Try a different host OS.

这篇关于如何在 Java 中追踪看似随机的崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆