• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to look for jar file content in linux?

 
Amandeep Singh
Ranch Hand
Posts: 850
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like in windows, if we open the jar file through winzip, we can see its contents.
Similarly without unzipping the jar file (means not creating a clutter of file by unzipping), we can see its contents.

Is it possible?
 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do this several ways in linux..

You can use:

#unzip -t file.jar | grep -i 'what your looking for'

which will give you a listing of it's contents including directory structure without actually unzipping it.


Alternatively, you can use
# find . -name file.jar | xargs grep -i 'what your looking for'

which will display the jar file, and a response if it was found in the jar.

cheers

Philip
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use the JAR tool that's included with the JDK (see documentation).

To list the files and directories inside a JAR:

jar tvf filename.jar
 
Amandeep Singh
Ranch Hand
Posts: 850
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. Actually i have a jar file of java classes.
The commands mentioned by you did not worked. it just says Binary matches jar file.
It won't let me to peek in the jar file.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amandeep Singh wrote:The commands mentioned by you did not worked. it just says Binary matches jar file.


http://faq.javaranch.com/java/ItDoesntWorkIsUseless
Please post the exact command entered and the response (copy and past it from your terminal window).

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic