ProGuard is a free Java processor that can compress your .jar executable, rename internal classes to make reverse engeneering more difficult (see tools like JD-GUI and test it on your .jar), and finally optimize the program bytecode.
I used some external libraries in the project jSQL Injection, for exemple jSoup for HTML cleaning and Apache Commons Codec for additional string methods like Base64. These libraries are usually big .jar file that you include in your project, thus expanding your .jar executable’s size. As I use less than 1% of these libraries’ methods, I always wondered how to get rid of the extra space.
ProGuard can process your .jar as expected, it can reduce executable’s size by 50% (as seen on the screenshot), but you must be aware of problems appearing for example if you use introspection (a.k.a reflection). I do use introspection for internal design ; jSQL Model communicates to the View by Interaction classes implemented only in view, Model only sends Interaction classname as a String but won’t be aware of the GUI’s class’ instances, as known in MVC pattern. In that case ProGuard will rename GUI classes by obfuscation, but your model will keep sending unchanged Interaction classname as String, and therfore will generate errors like:
So you must configure ProGuard tabs Shrinking and Obfuscation in order to add exceptions to keep your introspection classes working ; Click Add… button in the section Keep additional classes and class members, type your classes names or use wildcards like com.jsql.view.interaction.*, do not forget to click Add field… and Add method… to fill the corresponding class members (simply click Ok).
Now, in order to verify if your new ProGuard .jar executable has introduced regressions, you would like to test it via JUnit, at least that’s what I want to do, but it’s another journey and I wonder how to do this in Eclipse. Any help would be appreciate.