If I have a project with hundrends of jar
files, and e.g. I have an import
of a package that can not be found, how would I find which jar
should I include?
I.e. how do I know that package a.b.c
is defined in X.jar
under /filesystem/jars
where under this path there are hundrends of jars
?
Is there e.g. a tool to search inside jars? grep-like for jars?
Asked
Active
Viewed 6,460 times
0

Jim
- 18,826
- 34
- 135
- 254
-
2Have a look at this answer [find a jar file given the class name][1] [1]: http://stackoverflow.com/questions/1500141/find-a-jar-file-given-the-class-name – akluth Sep 13 '12 at 08:25
2 Answers
3
Just google with the class name say "org.apache.struts.action.ActionMessages + jar".
You will get the jars which has the respective class.
you can also search in http://www.jarfinder.com.

ashwinsakthi
- 1,856
- 4
- 27
- 56
1
You could also try to add the java option -verbose:class
to your startup options, this will produce dumps like:
[Loaded java.security.BasicPermissionCollection from shared objects file]
[Loaded sun.misc.JavaSecurityProtectionDomainAccess from C:\Program Files (x86)\Java\jdk1.6.0_32\jre\lib\rt.jar]
[Loaded java.security.ProtectionDomain$2 from C:\Program Files (x86)\Java\jdk1.6.0_32\jre\lib\rt.jar]
[Loaded java.security.ProtectionDomain$Key from C:\Program Files (x86)\Java\jdk1.6.0_32\jre\lib\rt.jar]
[Loaded java.security.Principal from shared objects file]
See also what-is-shared-objects-fil
I use eclipse with maven. In this environment I can simply open the class and choose View in Package Explorer
from the context menu. After that the Package Explorer shows the expanded strcuture of the jar in the Maven Dependcies.