Kev's Development Toolbox
Development Utils:

Back

Classpath Searcher


Overview

Searches the current classpath for specific files, classes, or using wildcards

Jar File ClasspathSearcher.jar
Source jar ClasspathSearcher_src.jar
Javadoc api ClasspathSearcher_docs.jar

Download and run now with Java Web Start



Description

I developed this app because I occaisionally needed to find which jar file in my classpath particular classes were being loaded from. This app will search through all directories, jars and zips in the current classpath for any class or file name.

You can also add additional directories, zips or jars to the list to be searched - this is useful if you need to search through a collection of jars for a particular file or class.

Running the app

1. To run the app from the jar:

java -jar ClasspathSearchApp.jar

This is probably only useful if you are going to manually add search directories/zips/jars to the search list once you have started the app, as the only thing in the classpath by starting the app from the jar will be the jar itself.

2. By adding the jar to the classpath - for example on Windows:

java -classpath %CLASSPATH%;ClasspathSearchApp.jar kh.classpathsearch.ClasspathSearchApp
Using the App

On startup, the app will show all the directories, zips and jars in the classpath in the left-hand side panel. You can either search through these, or add additional directories, zips and jars to the list.

Viewing content of Jars or Zips

If there are Jars or Zips in you current classpath (as displayed in the list on the left), you can display their content by clicking on the file name. The content of the file will be listed on the right panel.

Adding files to the search list

To add to the list select "File" and the "Add File..." on the menu.

Searching for Classes or Files

To search, selct "Search", and then "Search for a class" on the menu, or press "Ctrl-S". Enter a class name, or a partial search value then press search. If the search take a more than a second or so, you'll see a progress bar while search is being performed.

The results (if any) show the directory, zip or jar as the left-most value, followed by the file name that was found matching the search criteria.

Interesting Features
  • Swing UI
  • Illustrates use of custom Events and Listeners for notification between UI and business logic
Screenshot:

The screenshot below shows an example classpath (for Weblogic), and a search for files or classes matching 'Servlet':

Site designed and
developed by
MindBeans Software Consulting: Independent Consultants - Software Design and Development
© Copyright Kevin Hooke, MindBeans Software Consulting 2002-2008.
All Rights Reserved.
Running on JBoss4.2.0/Tomcat5.0, Linux Fedora Core FC4 2.6.11
Current uptime last checked at: Fri May 23 22:08:39 PDT 2008
22:08:39 up 19 min, 2 users, load average: 0.02, 0.22, 0.28
  Last updated: Oct 2007 v2.0