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
Eclipse 3.4 JDT
It is not the quickest way because you have to drag it into your eclipse first. But you will have full java class browsing, even with decompile enabled.
jar -tvf file_name.jar
above will only print names of the files.
To view the content of files, you can extract the files in a folder by:
jar -xvf file_name.jar
this will unzip jar file & put the content in same directory where you are running this.
Or in Windows rename .jar file to .zip & then you can unzip to extract & view the content of jar file. As jar is internally a zip file.
java -xf some-j.jar
will unzip a JAR file.
By adding a jar to a project in an IDE, you can usually see methods and field names, but not the detailed implementation. NetBeans can do it, Eclipse probably, IntelliJ probably, etc. You can browse the jar structure directly within the IDE.
For anything such as viewing the contents, you could use :
jar tvf jarfile.jar
To access source code, you would use a decompiler such as JAD or one of its frontends or another decompiler. If the code is obfuscated, then ...
My requirement was to view the content of a file (like a property file) inside the jar, without actually extracting the jar. If anyone reached this thread just like me, try this command -
unzip -p myjar.jar myfile.txt
This worked well for me!
Using the JDK, jar -tf
will list the files in the jar. javap
will give you more details from a particular class file.