为什么eclipse不能重新编译对Java类所做的最后更改? [英] Why eclipse doesn't recompile last changes made to my Java classes?

查看:104
本文介绍了为什么eclipse不能重新编译对Java类所做的最后更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只有1行的简单文件,可以在main内部打印 Hello World。我执行它,并在Eclipse控制台上打印 Hello World。现在,当我将字符串更改为
Bye world时,它仍然显示 Hello World。如果我通过将println修改为prrrintln导致语法错误,则实际上是这样。它仍然打印 Hello World。是什么会导致Eclipse不使用最新文件?
当我尝试从命令行运行它时,出现以下错误:

I have a simple file with just 1 line that prints "Hello World" inside main. I execute it and it prints "Hello World" on eclipse console. Now when I change the string to "Bye world" it still prints "Hello World". Infact if I cause a syntax error by modifying println to prrrintln. it still prints "Hello World". What can cause eclipse to not use the latest file ? When I try to run it from command line, I get the following error:

bin> java WordBreakProblem.class 
Error: Could not find or load main class WordBreakProblem.class

推荐答案


  1. 已自动检查构建

2。
运行WordBreakProblem类的正确方法是

2. The correct way to run WordBreakProblem class is

java WordBreakProblem

而不是

java WordBreakProblem.class

还要确保使用

javac WordBreakProblem.java

步骤2。

3。
如果代码仍然无法刷新,请尝试清理。

3. If the code still doesn't refresh, try "clean".

这篇关于为什么eclipse不能重新编译对Java类所做的最后更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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