Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the command line to quickly find out the Jar file where the Class file is located

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

How to use the command line to quickly find the Jar file where the Class file is located. For this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more small partners who want to solve this problem find a simpler and easier way.

Because jar command to find class file speed is relatively slow, I personally try to use 7z.exe,7z.dll, combined with batch processing, the effect is very good.

See examples:

for %i in (dir/b/s *.jar) do 7z l %i | findstr XDatabase.class

Results:

D:\shared\xsql>for %i in (dir/b/s *.jar) do 7z l %i |findstr XDatabase.class D:\shared\xsql>7z l dir/b/s | findstr XDatabase.class D:\shared\xsql>7z l db2jcc.jar | findstr XDatabase.class D:\shared\xsql>7z l db2jcc_license_cu.jar | findstr XDatabase.class D:\shared\xsql>7z l jconn3.jar | findstr XDatabase.class D:\shared\xsql>7z l jodbc.jar | findstr XDatabase.class D:\shared\xsql>7z l jTDS3.jar | findstr XDatabase.class D:\shared\xsql>7z l mlscript.jar | findstr XDatabase.class D:\shared\xsql>7z l msbase.jar | findstr XDatabase.class D:\shared\xsql>7z l mssqlserver.jar | findstr XDatabase.class D:\shared\xsql>7z l msutil.jar | findstr XDatabase.class D:\shared\xsql>7z l mysql-connector-java-5.1.6-bin.jar | findstr XDatabase.class D:\shared\xsql>7z l ojdbc14.jar | findstr XDatabase.class D:\shared\xsql>7z l postgresql-8.4-701.jdbc4.jar | findstr XDatabase.class D:\shared\xsql>7z l sqlite.jar | findstr XDatabase.class D:\shared\xsql>7z l sqlitejdbc-v056-zentus.jar | findstr XDatabase.class D:\shared\xsql>7z l sqljdbc.jar | findstr XDatabase.class D:\shared\xsql>7z l ULjDatabaseTransfer.jar | findstr XDatabase.class D:\shared\xsql>7z l UltraLiteJ.jar | findstr XDatabase.class D:\shared\xsql>7z l UltraLiteJ12.jar | findstr XDatabase.class [b]D:\shared\xsql>7z l xsql.jar | findstr XDatabase.class 2010-12-24 21:05:40 ..... 30863 14443 [/b]com\sean\db\XDatabase.class

The last row shows the final result.

Write the above logic into batch processing:

@echo off SETLOCAL set WHICH_CLASS=%1 echo WHICH_CLASS=%WHICH_CLASS% for /F %%i in ('dir /A:-D /S /B *.jar') do 7z l %%i | findstr %WHICH_CLASS% && echo %WHICH_CLASS% found in: "%%i" echo "Finished class finding... " echo "======================================" ENDLOCAL

Run the command:

findclass com\\sybase\\afx\\util\\StringUtil.class WHICH_CLASS=com\\sybase\\afx\\util\\StringUtil.class 2012-02-27 13:14:36 ..... 15230 5915 com\sybase\afx\util\StringUtil.class com\\sybase\\afx\\util\\StringUtil.class found in: "U:\target\lib\ext\sup-client.jar" 2012-02-27 13:14:36 ..... 15230 5915 com\sybase\afx\util\StringUtil.class com\\sybase\\afx\\util\\StringUtil.class found in: "U:\target\lib\ext\sup-server-rt.jar" "Finished class finding... " "======================================"

It is easy to get the final result. Given enough time, we can even modify the source code of 7z so that it lists the full path of the file directly, so that the final file can be found directly using 7z.

About how to use the command line to quickly find the Jar file where the Class file is located, the answer to the question is shared here, I hope the above content can be of some help to everyone, if you still have a lot of doubts, you can pay attention to the industry information channel to learn more about related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report