feiroox
feiroox

Reputation: 3199

how to find text in jar file which is in war file?

is there a way to grep(find) the text in a particular file, which is in *.jar and this *.jar is in *.war?

Upvotes: 1

Views: 4159

Answers (3)

Craig
Craig

Reputation: 1403

There is a 'common resource grep' command line tool, crgrep, which searches within various resources including archives, images, pdf, pom file dependencies and arbitrary nested combinations of these. So it will grep nestings such as text within a file in a jar which is buried in a war, within an ear. It also greps db table data and web page/url content.

https://sourceforge.net/projects/crgrep/

I developed crgrep as an opensource tool.

Upvotes: 1

Brian Beckett
Brian Beckett

Reputation: 4900

Are you doing this programmatically from Java?

.war files are basically .zip files, just like .jar files. You can open .zip files with java.util.ZipFile.

Open your .war as a ZipFile, find your .jar within it, open your .jar as a ZipFile, find your text file within it. Now you can read the text and process it however you want.

Does this answer your question?

Upvotes: 1

jar files are zip files, so you need a tool that can grep inside a zip file.

It appears there are several at http://www.freedownloadscenter.com/Best/grep-zip.html

Upvotes: 0

Related Questions