Viewing contents of a .jar file

后端 未结 30 940
一向
一向 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:50

    Well, a jar-file is just a zip-file, so if you unzip it (with your favorite unzipping utility), you get all the files inside.

    If you want to look inside the class files to see the methods, you'll need a tool for that. As PhiLho mentions, Eclipse is able to do that (by default), and I would think most Java IDEs are capable of that.

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

    One way to do this is to open the perspective in "Package explorer". Doing this you can see the structure of your jar with class details. For this check the library folder in your project using package explorer.

    Window>>Show View>>Other>>Java>>Package Explorer

    Another way is, you can use JarPlug as a eclipse plugin. This works in eclipse/springsource

    http://jar-plug.sourceforge.net/

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

    In case someone don't know this already, a JAR file is just a ZIP file that contains the program's classes, resources, etc., and some metadata. You can extract one to see how it's put together.

    Hence I am using unzip command which is easy to remember and use.

    unzip -l <jar-file-name>.jar

    For example, if you have a jar file with name test.jar then unzip -l test.jar will list all the content of jar file.

    While all other answers are great, but in most of them, you would have to use some software like 7 zip or JDK or some other eclipse tool while this doesn't require you to have any of these big s/w and it comes by default in linux and mac so its very lightweight and handy to use.

    You can also use zipinfo <your jar file>. if your OS supports this.

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

    I prefer JAR Browser, it has a simple interface where you can browse multiple JARs, and search for a specific class across multiple JARs simultaneously.

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

    On Mac there's Jarzilla

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

    I use JarExplorer or JarVisualizer.

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