My favorites | Sign in
Project Logo
                
Code license: Apache License 2.0
Labels: java, code, search
Links:
Feeds:
People details
Project owners:
  jeffpalm

Searches java byte code based on types and names or methods, etc. By passing patterns of methods and classes, this program searches these classes for methods that match these patterns.

Usage

To use it you can build from source or just unzip the tar ball and install it somewhere convenient -- e.g. /usr/share/jloogle. When installed, this program will print the methods that match patterns contained in the input. The input to the program can be one of the following specifying the classes to search:

  1. Jar files Classes contained in these files will be searched
  2. Class files These classes will be searched
  3. Directories Classes recursively contained under these will be searched
  4. Nothing If no classes are specifically specified, the programs CLASSPATH will be searched

The following are ways to specify the patterns of the methods

  1. String Simply passing a string to the program, such as "name(main)", will search all classes for methods matching that string
  2. Files Files containing method patterns can be found

Examples

The following are a few basic examples showing some of this program's features. We'll assume that the classes being searched are containg in a jar called code.jar, and this is the Java source code for a class compiled into this jar.

class Foo {
 void f() {}
 int g() {return -1;}
 public static void main(String[] args) {}
}



Finding the main methods To find the main methods one could invoke:

jloogle "name main and arg java.lang.String[]" code.jar

void Foo.main(java.lang.String)

Finding all methods that return an int To find the methods that return an int one could invoke:

jloogle "returns int" code.jar

int java.lang.Object.hashCode()

int Foo.gg()

Finding all methods called f or g To find the methods that are called f or called g one could invoke:

jloogle "name ff or name gg"

int Foo.gg()

void Foo.ff()

NOTE: The last example could have been jloogle "name(ff) or name(gg)", because the parentheses are optional.









Hosted by Google Code