[Solved] ‘Source code does not match the bytecode’ use IDEA debug JdbcTemplate

when i debug the JdbcTemplate sourcecode use IDEA?the IDE tips me?’Source code does not match the bytecode’


enter image description here

and i use mvn to manage my project?my maven pom config is:

Enquirer: guruboy


Solution #1:

Intellij gives such warning, when compiled code doesn’t match the source code. ie you try to debug the code, which has been changed and not builded again.

Make sure after you imported your code, you didn’t modify any piece of it and if you modify then first build/compile it and then only start the debugging.

for example below code will cause this warning :-

    public class HelloSO {
    public static void main(String[] args) {
        System.out.println("First time source code");

Now you compiled above class and start debugging it, everything works fine.

But after that you add one more print statement and try to put the debug point on that line without re-compile it, then in this case as byte code for new line is not generated, hence you will get same warning from IntelliJ.

Respondent: user156327

Solution #2:

This can also happen if you have multiple dependencies that themselves have different versions of the same dependency. This post on the JetBrains site shows how to enable the alternate source switcher in preferences.


Respondent: mouse_8b

Solution #3:

After viewing the other similar questions and answers on this problem, none of which helped me, what solved the problem was simply adding a dependency. In my case I ran into this issue when I was attempting to debug org.springframework.web.servlet.DispatcherServlet. I finally noticed that IntelliJ could not find javax.servlet in my imports.

In my Maven project, I added


to my pom.xml which solved the problem.

Double check that all of your imports are being resolved.

Respondent: Spencer Stewart

Solution #4:

For me this issue was arising because I’d made changes to my source code but had not yet deployed them to the target device. It still allowed me to set up the debugging which was confusing, but then gave me this error.

To fix:

  1. Rebuild your project / module
  2. Redeploy to your target device
  3. Run the debugger

After rebuilding / redeploying, your debug and deployed code will match up and you shouldn’t get any more errors! Just a matter of matching up the two binaries.

Respondent: Neil Ruggiero

Solution #5:

I had the same issue, too. The root reason is two different jar packages have some conflicts. So I solved it by removing one of the conflicting jar package.

Respondent: Rt.Tong

Solution #6:

I had a problem like yours today. I found that my IntelliJ was set to work with Java version 16 and my project was built in Java version 11.

To fix it, I did this: clicked on File -> Project Structure -> Project Settings -> Project, and changed “Project SDK” property to version 11.

After clicking on OK button, I didn’t get the message “source code does not match bytecode” anymore.

Respondent: Bruno

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.