Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Code not properly updating

This may seem a weird Q.

I had written a code in Java (in Eclipse). Then, I did some modifications to the code. Now, I am trying to run the new code (modified), but it is still giving me the output which it was giving for the previous code.

I have put few debug points in the code, but it is skipping some of the debug points (though it should stop at them) and stopping at some debug point, but even here it is calling the methods which were present in previous code at that location (though I have commented them now). It seems from somewhere it is still debugging the old code.

How to get rid of it?

Thanks!

like image 470
Vikram Avatar asked Jul 18 '11 17:07

Vikram


2 Answers

Have you tried cleaning the project?

Project(menu) -> clean

Also make sure

Project(menu) -> Build Automatically

is selected so that all new code you write is compiled then and there

If the clean and build doesn't work, it's possible that there is a jar file contains the class you edited, so the eclipse will run the compiled class file in the jar instead of your current file.

like image 71
Nivas Avatar answered Nov 17 '22 12:11

Nivas


There are two possibilities because of which the java code is not updating properly:

  1. Project -> Build Automatically is not checked
  2. In .project file of Project org.eclipse.jdt.core.javabuilder build command is commented or missing. Here the below mentioned piece of code should not be commented:

    <buildCommand>
         <name>org.eclipse.jdt.core.javabuilder</name>
         <arguments></arguments>
    </buildCommand>
    
like image 2
ammie1018 Avatar answered Nov 17 '22 14:11

ammie1018