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
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.
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/
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.
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.
On Mac there's Jarzilla
I use JarExplorer or JarVisualizer.