减少jar文件大小? [英] Reducing jar file size?

查看:179
本文介绍了减少jar文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一个很好的应用程序,通过消除冗余
类/方法/常量池元素来减少jar文件大小? (即不能从固定的
组入口点到达,假设没有反射)

Is there a good app to reduce jar file size by eliminating redundant classes/methods/constant pool elements? (i.e. not reachable from a fixed set of entry points, assuming no reflection)

我厌倦了在我使用从他们的几个方法。

I'm tired of pulling in bloated libraries when I'm just using a couple of methods from them.

(我不在说小的本地优化,如使名称更小我想更多的东西,做全局分析以确定使用哪些类/方法/变量,给定一组入口点(包括反射入口点),并删除所有未使用的内容。

(I'm not talking about small "local" optimizations like making names smaller. I'm thinking more of something that does global analysis to figure out which classes/methods/variables are used, given a set of entry points (including reflective entry points), and removes everything that is not used.

我的webapp是45MB,主要是由于30多个库,我确定我只使用每个库的一小部分。

My webapp is like, 45MB, mostly due to 30-odd libraries, and I'm pretty sure I'm using only a small fraction of each library.

推荐答案

是的,有一个 - Proguard

Yes, there is one - Proguard.


ProGuard是一个免费的Java类文件缩减器,优化器,混淆器,
和preverifier,它检测和删除未使用的类,字段,
方法和属性,优化字节码并删除未使用
指令。它使用短的无意义的名称重命名剩余的类,字段和方法
。最后,它预处理用于Java 6或Java Micro Edition的已处理
代码。

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

这篇关于减少jar文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆