Viewing contents of a .jar file

后端 未结 30 939
一向
一向 2020-12-02 03:54

What would be the easiest way to view classes, methods, properties, etc. inside a jar file? I\'m looking for something equivalent to the very useful Lutz Roeder .NET Ref

相关标签:
30条回答
  • 2020-12-02 04:42

    You could try JarSpy. There is an IDEA plugin version of it that I use.

    0 讨论(0)
  • 2020-12-02 04:43

    I usually open them with 7-Zip... It allows at least to see packages and classes and resources.
    Should I need to see methods or fields, I would use Jad but of course, it is better to rely on (good) JavaDoc...

    Now, somewhere on SO was mentioned some Eclipse plug-ins, to find in which jar file a class is located, perhaps they can do more (ie. what you requested).

    [EDIT] Reference to SO thread. Not what is asked, but somehow related, thus useful: Java: How do I know which jar file to use given a class name?

    0 讨论(0)
  • 2020-12-02 04:43

    You can view JAR files like ZIP files from Windows Explorer by doing the following:

    • Run Command Prompt as Administrator
    • From the command line, enter:

      assoc .jar=CompressedFolder

    • While you are at it, you might as well do the same for WAR and EAR files:

      assoc .war=CompressedFolder

      assoc .ear=CompressedFolder

    0 讨论(0)
  • 2020-12-02 04:44

    If you like to see whats inside, simply rename as first option below..

    1. F2 & Rename to jarfile.zip //Use any unzipper...

    2. jar tvf jarfile.jar

    3. jar tf jarfile.jar

    0 讨论(0)
  • 2020-12-02 04:44

    If you are in windows and using powershell and you are looking for a file in a jar you can do:

    jar -tf .\[JAR_NAME] | where {$_ -match "[FILENAME]"}
    
    0 讨论(0)
  • 2020-12-02 04:44

    I've set the default action in windows to "Open with WinZip". This makes it easy to manage JARs as archives. You can even add/remove files manually.

    0 讨论(0)
提交回复
热议问题