How do I find the packages defined in a jar?

前端 未结 5 1234
醉酒成梦
醉酒成梦 2020-12-17 18:05

I have a bunch of JAR files (from a maven2 project) and maven reports some package could not be found (org.openanzo.client.jena to be exact). I want to dig into the JAR file

5条回答
  •  攒了一身酷
    2020-12-17 18:47

    @Carsten you do not have to rename a .jar file to .zip. You can directly open the jar file in winzip/or other zip utility (assuming windows OS)

    @ashy_32bit try using "jar class finder" eclipse plugin from IBM. Simple plugin for finding classes (if you know the class name)

    OR

    as carsten suggested... set the jar files as lib files and manually look it up

    OR

    create a batch file called a.bat (where you have all your jar files directly under a single folder) and paste the following 4 lines

    @ECHO OFF
    dir /b *.jar > allJarFilesList.txt
    FOR /F %%A IN (allJarFilesList.txt) DO jar -tf %%A > list_of_packages.txt
    FOR %%B IN (list_of_packages.txt) DO FIND /I "com/sun" %%B
    

    NOTE the "com/sun" in the last line.. it is hard coded, you can pass as argument as well...

    I know this is very basic form and can be improved "a lot" like looking up in various sub directories.

    hope this helps :-)

提交回复
热议问题