Eclipse launches an old version of the program

I have a problem running my application in eclipse. I am making some changes as follows:

String res = "newvalue"; System.out.println(res); 

But when I run the application, I still get the "oldvalue" in the output. After that, I tried to remove the main () function, and I started the application, and again I will see the "oldvalue" on the output.

Perhaps this is some cache in the JVM or smth. yet?

UPD:

It's 15:35 on my watch. But in the / bin folder, I see .class files with a time stamp of 14:33. I change the source files (.java), press ctrl + f11 in eclipse, and the files in the / bin folder are still 14:33 ...

UPD2:

After cleaning up the project, I get the following problem:

The project was not created due to "Failed to write file: D: \ projects \ NelderMead \ bin \ ru.". Fix the problem, then try updating this project and creating it, as it may be inconsistent.

Decision

The problem was that eclipse could not write the file to a folder with spaces and UTF characters in that name. So, I copy the project to a new clean workspace, and it works without problems! Thank you all for your help in detecting the problem!

+6
source share
2 answers

You are executing old class files, the reason may be

  • compilation error somewhere else (see problem view)

  • or your randomly modified source path so that the new source no longer compiles.

Try to clean the project and make sure that the new classes are compiled into your output folder. The JVM does not have a cache for class files.

+5
source

First, make sure that the file is saved (there is no asterisk next to the file name in the tab). Usually files are saved automatically, but you can choose not to save files and never ask by mistake, the first time Eclipse pops up in this dialog box.

enter image description here

Then look what happens in the Problem view. You may see something like project cannot be built due to the following reason . This may be due to compilation errors in dependent projects.

enter image description here

+2
source

Source: https://habr.com/ru/post/903509/


All Articles