Java:断点如何阻止小程序绘画而不*被绊倒*?
在 Eclipse 中,我正在编写一些代码,用于抓取特定网页并下载小程序,然后将其添加到 JFrame 并执行。 如果我运行程序而不添加任何断点,它会完美运行。 它加载小程序,然后开始运行。 但是,如果我向小程序 update(Graphics g) 方法添加断点,它就会停止刷新。 显然,这是预期的,但它实际上从未触发断点。
我知道断点通常与我的设置一起工作,事实上,如果我向完全相同的小程序的 paint(Graphics g)
方法添加断点,它就会在您期望的任何时候发生故障。
唯一有点不传统的是我没有我正在显示的小程序的源代码。 相反,我只是在方法条目上设置一个断点。
如果我在小程序运行时禁用断点,它会恢复绘画,但如果我再次启用它,它不会总是停止重新绘画。
我不知道这是否是 eclipse/jvm 的预期行为,或者我是否发现了错误。 如果是bug,是eclipse的bug还是jvm的bug?
In eclipse I am writing some code that crawls a specific webpage and downloads an applet, which it then adds to a JFrame and executes. If I run program without adding any breakpoints, it works perfectly. It loads the applet, and it begins running. However, if I add a breakpoint to the applets update(Graphics g) method, it simply stops refreshing. This is expected, obviously, but it never actually trips the breakpoint.
I know breakpoints are working in general with my setup, and in fact if I add a breakpoint to the paint(Graphics g)
method of the exact same applet, it will trip whenever you would expect it to.
The only thing that is slightly unconventional about this is that I don't have the source of the applet which I am displaying. Instead, I simply set a breakpoint on the method entry.
If I disable the breakpoint while the applet is running, it resumes painting, but if I enable it again, it won't always stop repainting.
I don't know if this could somehow be the expected behavior of eclipse/jvm, or if I have found a bug. If it is a bug, is it a bug in eclipse or the jvm?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是一个建议:您能检查一下正在执行小程序的 JVM 版本吗?
有人提到断点问题< /a> (也详细这里)和最新的jdk6.0_u14,
因此,如果您使用此版本,您可能需要检查 6.0_u13。
Just a suggestion: could you check what version of the JVM you are executing your applet with?
There were mentions of troubles with breakpoints (also detailed here) and the latest jdk6.0_u14,
so if you are using this version, you may want to check if the same behavior is observed with 6.0_u13.
查看显示线程的调试面板。 很可能是另一个超出您预期的线程在断点处中断。
Have a look at the debug panel showing your threads. It might well be another thread than you expect that breaks on the breakpoint.