Search code examples
javacompiler-constructionbytecodedecompilingdecompiler

How can I tell why/how two class files are different?


I am trying to recreate some old source. I have two classes, one from my new source and one from the lost source. The both classes will decompile to identical source. However, a bit level compare of the classes still shows differences. How do tell what causes these differences?

GC_


Solution

  • I found just using javap to be very helpful.

    I ran this command for both classes:

    javap -version -l -v -p -c -s -sysinfo ClassName.class > temp.txt
    

    Then I compared the two files. This uncovered the difference I was looking for. It was a line number thing. I found eclipse's decompiler helpful, too.