在CLASSPATH中使用未使用的JAR文件的影响 [英] Impacts of having unused JAR files in CLASSPATH

查看:111
本文介绍了在CLASSPATH中使用未使用的JAR文件的影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里阅读了很多Q& A关于可用于查找未使用的 JAR的工具,例如:

I've read so many Q&A here about tools available to find out unused JARs, such as:


  1. loosejar

  2. Classpath Helper

  1. loosejar
  2. Classpath Helper

我的问题是,是否有任何影响(例如加载类的内存,性能等)在编译时或运行时在类路径中使用未使用的JAR?问题适用于作为独立程序运行和Web服务器(Apache Tomcat),尽管我最初只考虑独立程序。

My question here is, are there any impacts (such as loading of classes into memory, performance, etc.) of having unused JARs in the classpath either at compile time or run time? Question applies to both running as a Standalone program and Web Server (Apache Tomcat), though I initially thought about only Standalone programs.

注意:我正在运行JDK 6u32(64位)。

NOTE: I'm running JDK 6u32 (64-bit).

推荐答案


是否有任何影响(例如在编译时或运行时在类路径中使用未使用的JAR的类加载到内存,性能等中?

Are there any impacts (such as loading of classes into memory, performance, etc.) of having unused JARs in the classpath either at compile time or run time?

会产生很小的影响。当类加载器(或编译器的等价物)启动时,它必须读取每个JAR文件的索引以找出每个JAR中的类。如果你在类路径上有不必要的JAR,那么类加载器还有更多的工作要做,并且(至少暂时)会使用更多的内存来缓存索引。

There is going to be a small impact. When the class loader (or the compiler's equivalent) starts, it has to read the index of each JAR file to find out what classes are in each JAR. If you've got unnecessary JARs on the classpath, the classloader has more work to do, and will (at least temporarily) use more memory to cache the indexes.

这个适用于各种Java应用程序。

This applies to all kinds of Java application.

您没有问的问题是影响是否显着。答案是一般都不......但是你在类路径上的无用的东西越多,影响就越大。

The question that you didn't ask is whether the impact is significant. The answer is "generally no" ... but the more "useless stuff" you have on the classpath, the greater the impact is going to be.

这篇关于在CLASSPATH中使用未使用的JAR文件的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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