Jar Search

Frustrated by all the time wasted expanding and repacking J2EE enterprise application archives (ear files) looking for bean classes and the like, I wrote this small tool for searching an archive recursively for files whose paths match a regular expression.

Here's a sample use:

$ java -jar jarsearch.jar -a CMRouter New_Project.ear
Searching for 'CMRouter' ...
There are 3 matches:
New_Project.ear>New_Project.jar>frameworkImpl/model/router/CMRouterBean.class
New_Project.ear>New_Project.jar>frameworkImpl/model/router/CMRouterLocal.class
New_Project.ear>New_Project.jar>frameworkImpl/model/router/CMRouterLocalHome.class

It consists of one class, which may be viewed here. To compile it, you will need the the GNU regexp jar, a copy of which can be found in the tarball below.

Download it here: gzipped tar archive (33K)

The above archive contains an ant based project with full source. You are welcome to use this code as you see fit. Just untar the archive and run "ant dist" to produce jarsearch.jar in the project directory.