简体   繁体   中英

In Eclipse, the changes of my source code have no effect

I have a strange problem in Eclipse Helios. When I alter my source code, my changes have no effect. Even if I alter the code in a way that looks uncompilable, it still can be run.

It seems that Eclipse keeps its state somewhere in the background while I edit and save my sources and commit them to svn.

I don't know what setting to look up or what else to do. I'd be glad to receive any help.

Note : Please try this only if you have run out of other options in this thread.

So Just in case the other options like clean/rebuild listen in the other answers, do not address the problem do the following,

Close eclipse Go to the project folder on the hard drive. Delete the .metadata file and restart eclipse and revisit the workspace. The class path and libraries will be re validated and the project fresh built.

Project菜单中,确认已选中Build Automatically

I was having the same problem while running a Maven project in Spring Tool Suit (which is based on Eclipse). I needed to clean and build the maven project every time to make the STS detect the new changes (what is obviously a slow and inefficient process).

So my solution was:

Pressing Alt+F5 and check Force update of Snapshots/Releases

如前所述,在Project->Build Automatically验证您的 Build Automatically 选项,然后清理项目,以便再次编译您的更改。

只需转到“项目->自动构建”并检查就可以了

This is on Eclipse (Kepler). Simple "Hello World" in Java where changes to text in println where not reflected in console when doing a run or relaunch (Build automatically was checked). When doing a second relaunch ( or saving the .java file 1st) it always showed the changes to the println.

Kristian

Try doing some minor changes in the JSP file. Sometimes your Tomcat server contains old cache files which it uses even if you CLEAN BUILD your project. Bringing updates in the JSP files helps Tomcat deploy the JSP file with modifications rather than using the old cache files. I faced a similar problem which was resolved the same way. Thanks to Latest changes are not reflected in servlet (tomcat)

This is an old post but I had a similar issue recently which was not resolved by deleting the jar or building it. In Eclipse I tried the following:

Window --> Preference --> LIB --> Expand it and delete the jar (which is to be replaced). 

This will delete the reference from the project. After that I just added it back using:

Properties --> Java Build path --> Libraries and adding the jar. 

It's possible that you have copied the previous code from an old class but that class-name is still same, then this file will be using the old class. Make sure you changed the class name also..

I hope this could solve the problem.

Your operating system simply does not allow modifying a file while it is in use, so the compilation fails. The compiler can't remove the old executable and place a new one. Because of this, save the code and restart Eclipse, build, and run again

首先尝试(重新)构建或保存。

This most probably occurs when the meta data related to the workspace is corrupted. Simple solution would be to create an entirely new folder as workspace and import the project into this new workspace.

This is after you have tried all the clean build, rebuild etc.. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM