com.xigole.util
Class ClassFinder

java.lang.Object
  extended by com.xigole.util.ClassFinder

public class ClassFinder
extends java.lang.Object

A simple utility to find a particular class name in a directory containing jar, war, and ear files. The application recursively decends into the directory looking for files that end in ".jar", ".war", and ".ear" (case insensitive which is not really the standard). Additionally, the program finds any normal files that end in .class also.

A sample command line might look like:
java -classpath lib/classfinder.jar -d some/directory/name -c SomeClassName

The command line arguments are:

Why did I write this? Because I find that when I'm looking for a particular class to compile with I never seem to know which jar file it is in. This utility simplifies that task. It is basically like a Unix "find" command piped to the "jar" command that would "grep" for the class name. Cross-platform issues made it easier to put into a small java application rather than have to install Cygwin on every Windows box I use. Copyright (C) 2004-2006 Scott Dunbar (scott@xigole.com)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Changes: November 07, 2006 1) Fixed a bug that prevented searching directories that ended with one of the Java archive extensions (.jar, .ear, .war, etc.). Thanks to Narasimhan Balasubramanian (narsibvl_2006@yahoo.com) for help with this. 2) Added the ability to find .class files too.


Constructor Summary
ClassFinder(java.lang.String[] argv)
          Public constructor that expects to be given the argument array from the command line.
 
Method Summary
static void main(java.lang.String[] argv)
          The driver for the ClassFinder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassFinder

public ClassFinder(java.lang.String[] argv)
            throws java.lang.IllegalArgumentException
Public constructor that expects to be given the argument array from the command line.

Parameters:
argv - - an array of Strings from the command line.
Throws:
an - IllegalArgumentException if the command line is invalid or if the directory name specified is not really a directory.
java.lang.IllegalArgumentException
Method Detail

main

public static void main(java.lang.String[] argv)
The driver for the ClassFinder.