Java source code search

Java source code search is an open-source, GPL-licensed tool that searches Java (1.6) source code elements that containing a match to the given search patterns. Java source code search tool is also static analysis tool. It has an integrated Java parser (antlr) which is used for searching tokens. You can search, for example, statements, variables by name or by type and method calls from the Java source code.

Why would you need a Java source code search and not use the normal search tool such as grep? If you need to search for the Java tokens, such as, statements or method calls from the Java source code, you need to parse the source code first.

An example of a situation when you would need this kind of a tool, is when you have several Java source code files and there are some finalize methods for some objects that need to be run last (see examples in manual) and you want to make sure that those objects call the finalize methods at the end. Verifying manually that all the finalize methods are called at the end may take a lot of time. With the search tool you can automatically verify this by searching the object and its method calls with its powerful search criteria. There is a great tool FindBugs which checks also missing close methods for some objects and other bugs as well.

Installing Java source code search tool

After you have downloaded the latest package you must extract it first

Example
gunzip -dc jsearch_0.2b.tar.gz | tar xf -
it will create a jsearch named directory change the working directory to jsearch
cd jsearch
with the current release you have to run the tool under that directory
./jsearch.sh

Downloads

To download the Java source code tool

Date of last update: 2011-04-23. Copyright Roni Hursti

Valid HTML 4.01 Strict