Comparing two .jar files

前端 未结 11 1520
灰色年华
灰色年华 2020-12-04 06:57

How do I compare two .jar files? Both of them have compiled .class files.

I want the difference in terms of method changes, etc.

11条回答
  •  忘掉有多难
    2020-12-04 07:06

    In Linux/CygWin a handy script I use at times is:

    #Extract the jar (war or ear)
    cd dir1
    jar xvf jar-file1
    for i in `ls *.class`
    do
     javap $i > ${i}.txt #list the functions/variables etc
    done
    
    cd dir2
    jar xvf jar-file2
    for i in `ls *.class`
    do
     javap $i > ${i}.txt #list the functions/variables etc
    done
    
    diff -r dir1 dir2 #diff recursively
    

提交回复
热议问题