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.
Minification is the process of minimizing code and markup in your web pages and script files. It's one of the main methods used to reduce load times and bandwidth usage on websites. Minification dramatically improves site speed and accessibility, directly translating into a better user experience.
(ˈmɪnɪˌfaɪ ) verbWord forms: -fies, -fying or -fied. (transitive) rare. to minimize or lessen the size or importance of (something)
To minify JavaScript, try UglifyJS. The Closure Compiler is also very effective. You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.
How Minification Works. Minification works by analyzing and rewriting the text-based parts of a website to reduce its overall file size. Minification extends to scripts, style sheets, and other components that the web browser uses to render the site. Minification is performed on the web server before a response is sent ...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With