Dmitry Belaventsev
Dmitry Belaventsev

Reputation: 6657

Eclipse run old version of program

I have a problem while runing my application in eclipse. I make some edits like this:

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

But when I run the application I still receive "oldvalue" in output. After this I tried to delete main() function - and I run application and I see "oldvalue" in output again.

Maybe it's some cache in JVM, or smth. else?

UPD:

It's 15:35 on my clock now. But in /bin folder I see .class files with 14:33 timestamp. I change source files (.java), press ctrl+f11 in eclipse and files in /bin folder are still 14:33 ...

UPD2:

After cleaning the project I receive the following problem:

The project was not built due to "Could not write file: D:\projects\NelderMead\bin\ru.". Fix the problem, then try refreshing this project and building it since it may be inconsistent

SOLUTION

The problem was that eclipse can't write file to the folder with spaces and UTF chars in it's name. So, I copy project to the new clean workspace and it runs without problems! Thx all for help detecting the problem!

Upvotes: 7

Views: 10629

Answers (2)

jFrenetic
jFrenetic

Reputation: 5552

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

enter image description here

Then see what's going on in the Problems view. You might see something like project cannot be built due to the following reason. It may be because of compilation errors in the dependent projects.

enter image description here

Upvotes: 3

stacker
stacker

Reputation: 68992

You're executing an older class files, the reason could be

  • a compile error somewhere else (see problems view)

  • or your changed accidentally the source path so that the new source no longer gets compiled.

Try to clean the project and make sure the new classes are compiled to your output folder. The JVM doesn't have a cache for class files.

Upvotes: 5

Related Questions