java-Contents.gz files


It's quite difficult to tell which classes are defined in which jar, and in turn to which package this jar may belong.

To solve that issue I propose to create java-Contents.gz files that, for a given release, contains the mapping for all classes published in all packages in Ubuntu (main, universe and multiverse), under this format:

package component jar class

How to use

You usually zgrep for what you want in the file. Examples:

Where is this class defined ?

To see where to find the javax.servlet.http.HttpServlet class, you can use:

$ zgrep -e ' javax.servlet.http.HttpServlet$' intrepid-java-Contents.gz
glassfish-javaee universe /usr/share/java/glassfish-javaee-2+b58g.jar javax.servlet.http.HttpServlet
glassfishv2 multiverse /usr/share/glassfishv2/lib/javaee.jar javax.servlet.http.HttpServlet
libservlet2.3-java main /usr/share/java/servlet-2.3.jar javax.servlet.http.HttpServlet
libservlet2.4-java main /usr/share/java/servlet-api-2.4.jar javax.servlet.http.HttpServlet
libservlet2.5-java main /usr/share/java/servlet-api-2.5.jar javax.servlet.http.HttpServlet
roxen4 universe /usr/share/roxen4/java/classes/servlet.jar javax.servlet.http.HttpServlet

How to recreate

The script used to create the java-Contents.gz file is currently available in a bzr branch at

JavaTeam/JavaContents (last edited 2011-11-09 16:14:06 by james-page)