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
Is there a correlation between two issues here?
解决方案
Have Build Automatically checked
2.
The correct way to run WordBreakProblem class is
java WordBreakProblem
instead of
java WordBreakProblem.class
Also make sure you compile the java source code into WordBreakProblem.class by using
javac WordBreakProblem.java
before doing step 2.
3.
If the code still doesn't refresh, try "clean".