Java 类查找工具
任何经常使用 Java 的人都知道类路径中的多个 jar 会给我们带来多少麻烦。我正在寻找一个可以帮助我的工具 -
- 在 Classpath 中搜索 jars 内的类文件
- 在 特定位置 中搜索 jars 内的类文件
- 也许要求太多了,但是显示多个罐子中是否存在同一个类。
不用说它应该很快。我评估过的大多数工具都非常慢并且达不到标准。
任何用于上述目的的工具都非常感谢。
目前我使用 WinRar 实现搜索(顺便说一句,速度非常快)来搜索特定位置的 jar 内的类文件。但无法利用它在类路径中进行搜索。
Anyone who uses Java regularly knows the amount of trouble multiple jars in classpath can give us. I am looking for a tool which will help me -
- Search for class files inside jars in Classpath
- Search for class files inside jars in a specific location
- Maybe too much to ask for but show me if the same class is present in multiple jars.
Also needless to say it should be fast. Most of the tools i have evaluated are very slow and not upto the mark.
Any tools for the above purpose greatly appreciated.
Currently i use WinRar achieve search(which BTW is really fast) to search for class files inside jars in a specific location. But there is no way to utilize that to search in Classpath.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果您使用 Bash,此脚本可能会有所帮助:
If you use Bash this script may be helpful:
如果您使用的是 eclipse,那么 IBM 的 classfinder 可能会很有用。您可以对(一组)目录中的类执行(模糊)搜索,并获取包含此类的所有 jar。
但是,不确定类路径选项。
问候,
纪尧姆
If you are using eclipse, then IBM's classfinder may be useful. You can perform a (fuzzy) search for a class in a (set of) directories, and get all jar that contains such a class.
Not sure about the classpath option, however.
regards,
Guillaume
您可以使用 jarbrowser 来实现此目的
You can use jarbrowser for this
如果您正在使用 Eclipse,并且它们位于您的类路径中,您可以使用 CapitalCaseControlSpace 进行您想要的操作。
例如,如果我想获得一个新的 ApacheFanUtilityMethodizerFunctor(当然,每个人都需要),我只需键入 AFUMF,然后按 Ctrl+Space,它就会为我填充它。因为它已经在我的类路径上,所以我不需要寻找它,因为它就在那里。
现在,如果它不在我的类路径中,并且我必须找到它所在的 jar 以便将其包含在内,然后返回到 WinRAR(或者对我来说,通常是 Google)。
If you're using Eclipse, and they're on your classpath, you can CapitalCaseControlSpace what you want.
For example, if I want to get a new ApacheFanUtilityMethodizerFunctor (which everyone needs, of course) I simply type AFUMF and then Ctrl+Space and it populates it for me. Since it's already on my classpath, I don't need to hunt for it, because it's there.
Now, if it wasn't on my classpath, and I had to find what jar it was in for purposes of including it, then back to WinRAR (or for me, Google typically) I go.
我自己的管理 java jar 文件和 java 类路径的解决方案非常简单。首先,我在其中创建文件夹,例如:
在这里我放置了我需要使用的所有 *.jar 文件。
然后我修改:
系统变量并添加上面所示的路径。
当一个类位于两个不同的罐子中时会出现问题,但我管理我的罐子以避免这个问题。
现在,当 java 运行时,jvm 可以找到我的类,并且不会抛出 ClassNoFoundException 。
My own solution for managing java jars files and java classpath is really simple. Firstly I create folder inside e.g.:
Here I put all my *.jar files which i need to use.
Then I modify the:
system variable and add this path shown above.
Problem occurs when one class is in two diffrent jars but I managed my jar to avoid this problem.
Now when java is running jvm can find my classes and ClassNoFoundException isn't thrown.
回复晚了,但如果有人搜索有类似的问题,我几年前写了一个简单的工具,我一直用它来解决这类问题。
它可以免费使用并且开源。如果您觉得它有用,请告诉我,:-)
https://github.com/eurozulu/Findclass
A late response, but in case anyone searching has a similar problem, I wrote a simple tool a few years back that I use all the time for this sort of problem.
It's free to use and open source. If you find it useful, let me know, :-)
https://github.com/eurozulu/Findclass