Regex search for a class in the JVM runtime classpath Add comment to Wiki View in Wiki Edit Wiki page Printable Version

Description

The below code searches through the classpath of a groovy script or a running groovy application and prints out classes which match the given regular expression. This is useful when you hit some variation of JAR hell and want to figure out which files contribute a specific class to your groovy classpath, be it a standalone script, a compiled joint java/groovy project, a grails project or something else. 

Credits for the recursive classpath code go to 'blindgaenger' at:  

 http://blog.blindgaenger.net/print_groovys_classpath_for_debugging.html

The code has been modified to do a regex search as per below.

Code

test.groovy

To try this out, paste the above code into 'test.groovy' and execute as follows: 

 

Author: Matias Bjarland, Iteego Inc

 

Search

Results of your search request can come from various sources: the Groovy website itself, the JIRA issues, the API documentation, as well as a few other interesting Groovy-related blogs.

  By  -  pages  -  views  - last modified