java 如何找到Java类所属的Jar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13951175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find Jar to which an Java class belongs
提问by Amandeep Jiddewar
I need to know TimedWindowEvent
class belongs to which JAR when JDK/JRE is downloaded. Is there any generalized
way of searching Jar to which a particular class belongs to using Eclipse or any other tool. Right now I have to open jar in winrar
and go through each and every jar to find if class I am searching for is present there.
TimedWindowEvent
下载 JDK/JRE 时,我需要知道类属于哪个 JAR。有什么generalized
方法可以使用 Eclipse 或任何其他工具搜索特定类所属的 Jar。现在我必须打开 jarwinrar
并检查每个 jar 以查找我正在搜索的类是否存在。
采纳答案by cowls
You could start by searching for the class on JarFinder.
您可以从在 JarFinder 上搜索类开始。
Not perfect as sometimes a class is in more than one JAR. But this may help narrow down the search.
不完美,因为有时一个类在多个 JAR 中。但这可能有助于缩小搜索范围。
If the link stops working, there are other similar services that can be found using you favourite search engine.
如果链接停止工作,可以使用您最喜欢的搜索引擎找到其他类似的服务。
回答by someone
In eclipse you could use ctrl+shift+t
(That's means you are searching on targets ) it will popup a window and put your class name. It will show you jars that class name belongs to.
在 eclipse 中你可以使用ctrl+shift+t
(这意味着你正在搜索目标)它会弹出一个窗口并输入你的类名。它将向您显示类名所属的 jar。
回答by Sajan Chandran
In eclipse, open some class and just import TimedWindowEvent
class and press function key F3
or press Ctrl+mouse click
eclipse will take it to the jar the class comes from.
在 eclipse 中,打开一些类并导入TimedWindowEvent
类并按功能键F3
或按Ctrl+mouse click
eclipse 会将其带到该类来自的 jar 中。
回答by moeTi
If you are using Eclipse, use the "Open Type" dialog (ctrl-shift-T) and search for the class.
如果您使用 Eclipse,请使用“打开类型”对话框 (ctrl-shift-T) 并搜索该类。
When it is found, at the bottom of the dialog you can see which jar file it is in.
找到后,在对话框底部您可以看到它在哪个 jar 文件中。
This only works if the jar file is in your classpath.
这仅在 jar 文件在您的类路径中时才有效。
回答by Santosh
In Eclipse:
在日食中:
- Press Ctrl+Shift+T
- This will open a dialog box. Enter the class name.
- Then it will search all the matching class files
- On selecting class file, at the bottom of the dialog box, it shows the jar file in the class path which contains this class.
- 按Ctrl+ Shift+T
- 这将打开一个对话框。输入班级名称。
- 然后它将搜索所有匹配的类文件
- 在选择类文件时,在对话框的底部会显示类路径中包含该类的jar 文件。