下载地址:http://proguard.sourceforge.net
以下面的Test.java文件为例:




































































首先jar cvf a.jar *.class打包程序,然后jad -d d:/ -r -s java d:/*.class反编译程序,生成Test.java文件,通过对比可以发现,它和原来文件的内容基本是相同的。






























































































进入Proguard的lib目录,用JDK打开proguardgui.jar,点选Input/Output标签,选择要混淆的JAR包(注意是JAR包),输出JAR包,以及用到的所有类库。
点选Obfuscation标签,选中不需要混淆的类(要被反射的类绝对不能被混淆),一般是1,4,5,9,10,11
,12这几个选项。
a.txt的文件内容为:(混淆函数名)
Gcd
b.txt的文件内容为:(混淆类名)
A
B
点选Process标签,Process按钮,生产b.jar
解压b.jar后,这时的3个class文件分别为A.class、B.class、Test.class;
重新反编译程序jad -d d:/b/ -r -s java d:/b/*.class,生成3个java文件:A.java、B.java、Test.java,具体内容如下:
A.java
























B.java
























Test.java






































