java - 如何在项目中找到不需要的jar

标签 java maven jar

我的项目中有一些 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.

使用方法:

  1. Start your application or application server with -javaagent:loosejar.jar flag (loosejar.jar should obviously point to the correct path of the actual jar)

  2. Exercise your application to make sure that the classes get loaded into the JVM.

  3. 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/

相关文章:

java - 如何将 .jar 文件添加到 Mac OS X 上的类路径?

java - 我如何在这个java项目中使用maven

eclipse - .class 文件内的行数与 eclipse 编译和 maven 编译不同

java - 访问 .jar 文件中的文件

java - 无法使用 Jar 文件找到或加载主类。原因是 bcprov-jdk15-133

java - 为什么这个函数不能像它应该的那样向 ArrayList 添加项目?

java - Derby/JavaDB 与 SQLiteJDBC

java - 构造函数中的可重写方法调用 - 调用该方法的正确方法是什么?

java - 对于 Thorntail 项目,pom.xml 中的所有依赖项 groupId 都必须是 io.thorntail?

java - RPG调用Java,java.lang.NoClassDefFoundError