Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to shrink external java libs?

I'm writing an applet, which uses ~10 external libraries. Together they occupy more than 2 megabytes. In some libs we use only 1-2 classes, so a lot of others can be safely deleted. So the question is how to remove unused classes from jar libraries?

A lot of other questions link to Proguard. But it doesn't process libraries (or I am doing something wrong) and also ruins parts of code which use reflection.

like image 917
tema.gogoti Avatar asked May 10 '26 03:05

tema.gogoti


1 Answers

You could use the maven-shade-plugin and tell it to build a minimized jar file that combines your code and libs.

like image 184
bmargulies Avatar answered May 11 '26 15:05

bmargulies



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!