Search code examples
javaminify

java source code minifier?


Is there a tool out there for minifying java source code?

I am aware there is not much practical need for such a tool, but I am interested to reduce some students' code to 'bare bones' to show how their variable names are interpreted (sort-of -- it will heopfully re-enforce that their choice of variable names are disregarded) by the compiler. (The next step in this pedagogical process might be to show them the compiled code).

Thanks.


Solution

  • In the java world we mostly speak, due to the purpose, of obfuscation (even if in my opinion the impact on application file size can be useful, I used it a lot on Android applications a few years ago).

    The best java obfuscator is probably Progard. Like all of them, it can reduce all (non exported) class and/or variable names to just a letter, which is part of the obfuscation as well as part of a minification.

    You will have to decompile the bytecode afterwards if you want to show some java.