Hello.
I need add some jars to a java project, but I download a zip with many jars inside, then I only need copy someones for import it in the Project.
For found the jars which have the class that I will use i write this small utility:
Edit: Posted the new version.
findjar.cmd (new version)
Code: Select all
@Echo off
SetLocal EnableDelayedExpansion
Set "toFound=%~1"
Set "toFound=!toFound:.=\!"
For %%j in (*.jar) do (
For /F "tokens=6 " %%n in (
'7z.exe l "%%~j" ^| Find "!toFound!"') Do (
Set "j=%%n"
Set "j=!j:\=.!"
Echo %%j : !j!
)
)
It uses 7z.exe from 7zip. I copy 7z.exe and findjar.cmd to \Windows\System32
Note: the search is case sensitive.
Code: Select all
C:\Users\Carlos Montiers\Desktop\librerias>findjar2 AbstractMessage
httpcore-4.0.1.jar : org.apache.http.impl.io.AbstractMessageParser.class
httpcore-4.0.1.jar : org.apache.http.impl.io.AbstractMessageWriter.class
protobuf-java-2.4.1.jar : com.google.protobuf.AbstractMessage$1.class
protobuf-java-2.4.1.jar : com.google.protobuf.AbstractMessage$Builder.class
protobuf-java-2.4.1.jar : com.google.protobuf.AbstractMessage.class
protobuf-java-2.4.1.jar : com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream.class
protobuf-java-2.4.1.jar : com.google.protobuf.AbstractMessageLite$Builder.class
protobuf-java-2.4.1.jar : com.google.protobuf.AbstractMessageLite.class
and also allow use package prefix:
Code: Select all
C:\Users\Carlos Montiers\Desktop\librerias>findjar2 io.AbstractMessage
httpcore-4.0.1.jar : org.apache.http.impl.io.AbstractMessageParser.class
httpcore-4.0.1.jar : org.apache.http.impl.io.AbstractMessageWriter.class