Eclipse运行旧版本的Java程序 [英] Eclipse running old version of Java program

查看:200
本文介绍了Eclipse运行旧版本的Java程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Eclipse 4.5.2。



假设我写了一个程序VERSION1。



然后,我更改了一些事情(更改的数量似乎并不重要),并获得VERSION2。



如果我现在使用运行按钮运行程序,它(几乎?)始终启动VERSION1。当我再次点击运行按钮,而不改变任何东西,它运行VERSION2。我没有看到运行之间有任何新的编译,我无法想象为什么甚至可以这样做。



有人知道这个行为吗?或至少有一个线索发生了什么?



编辑:在我的示例中,我将更改包含VERSION1的相同源文件以获取VERSION2。例如,我可能会修复一个错误并再次运行代码,但是它会运行旧版本的错误。只有当我第二次运行(没有改变任何东西的时候),它运行版本没有bug。



编辑3:它只会偶尔发生。大多数时候,Eclipse按预期启动VERSION2,但有时候,旧版本的代码(即VERSION1)就像VERSION2从未编译一样开始。

解决方案

首先保存文件并清理项目。然后运行它。
Eclipse通常会做一些愚蠢的东西;


I have Eclipse 4.5.2.

Suppose I write a program VERSION1.

Then, I change some things (the amount of changes seems to be of no importance) and get VERSION2.

If I now run the program using the "Run" button, it (almost?) always starts VERSION1. When I click the "Run" button again without changing anything, it runs VERSION2. I don't see any new compilation going on between the runs and I cannot imagine why or even how this is possible.

Does anybody know this behavior? Or has at least a clue what is going on?

Edit: In my example I would change the same source file that contains VERSION1 to get VERSION2. I may, for example, fix a bug and run the code again, but it runs the old version with the bug. Only when I run it a second time (without changing anything in the meantime) it runs the version without the bug.

Edit3: It only happens sporadically. Most of the time Eclipse starts VERSION2 as expected, but sometimes, an older version of the code (that is, VERSION1) is started as if VERSION2 was never compiled.

解决方案

Save your files and clean your project first. Then run it. Eclipse usually does some stupid stuff;

这篇关于Eclipse运行旧版本的Java程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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