我的项目中有一些 jar 。我想知道这些 jar 是如何使用的,或者如果我把它们去掉会有什么影响?
最佳答案
您可以使用 loosejar 来实现它.
It is a simple Java Agent that can be used to discover unnecessary jars lying on application classpath. It performs per classloader JVM heap analysis and displays its results. loosejar can be safely used during development, QA, UAT or even in production as it doesn't modify the state of the JVM at all and adds no overhead.
使用方法:
Start your application or application server with -javaagent:loosejar.jar flag (loosejar.jar should obviously point to the correct path of the actual jar)
Exercise your application to make sure that the classes get loaded into the JVM.
Get loosejar analysis results via JMX console (open jconsole and run com.googlecode.loosejar.LooseJarMBean#summary() in MBeans folder) or on application shutdown (via regular console log).
关于java - 如何在项目中找到不需要的jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20879407/