问题描述
我的程序有一个错误,导致抛出ClassCastException.我省略了程序中导致该异常的行,并做了一些其他小的更改,但是每次运行它时,似乎都在运行该程序的旧版本,因为仍会抛出ClassCastException并且stacktrace指向程序中不存在的行!
My program had a bug that resulted in a ClassCastException being thrown. I omitted the lines in my program that resulted in this exception, and made a few other small changes, but every time I run it, it appears as though the older version of the program is being run, since the ClassCastException is still thrown and the stacktrace refers to nonexistent lines in the program!
有人知道为什么会这样吗?重新启动Eclipse并没有帮助.
Any idea why this is? Restarting Eclipse did not help.
推荐答案
如果Eclipse由于语法错误而无法编译一个类,它将使用最后一个可编译版本运行,直到确定了当前版本为止.
If Eclipse can not compile a class due to a syntax error, it will use the last compilable version to run, until the current one is fixed.
这篇关于为什么Eclipse执行我的Java程序的旧版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!