See Groovy Classpath

I used this code fragment to print my groovy classpath from within a groovy script :


def printClassPath(classLoader) {
  println "$classLoader"
  classLoader.getURLs().each {url->
     println "- ${url.toString()}"
  }
  if (classLoader.parent) {
     printClassPath(classLoader.parent)
  }
}
printClassPath this.class.classLoader

and we can see our full classpath sequence to determine missing / wrong jars ! Like this:

groovy.lang.GroovyClassLoader$InnerLoader@76911d
groovy.lang.GroovyClassLoader@b155b7
org.codehaus.groovy.tools.RootLoader@c51355
- file:/Volumes/Media1/Software/menus/./
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-antlr-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-junit-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-launcher-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/commons-logging-1.1.1.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/gpars-1.0.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-ant-2.1.4.jar
- file:/Volumes/Media1/Software/g.4/lib/antlr-2.7.7.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-analysis-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-commons-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-tree-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-util-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/bsf-2.4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/commons-cli-1.2.jar - file:/Volumes/Media1/Software/groovy-2.1roovy-2.1.4/lib/groovy-bsf-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-console-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-docgenerator-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-groovydoc-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-groovysh-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-jmx-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-json-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-jsr223-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-servlet-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-sql-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-swing-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-templates-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-test-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-testng-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-xml-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/hamcrest-core-1.3.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ivy-2.2.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jansi-1.6.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jcommander-1.27.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jline-1.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jsp-api-2.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jsr166y-1.7.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/junit-4.11.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/qdox-1.12.1.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/servlet-api-2.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/testng-6.8.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/xmlpull-1.1.3.1.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/xstream-1.4.2.jar
sun.misc.Launcher$AppClassLoader@a9c85c
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-2.1.4.jar
sun.misc.Launcher$ExtClassLoader@cc7ad6
- file:/System/Library/Java/Extensions/AppleScriptEngine.jar
- file:/System/Library/Java/Extensions/CoreAudio.jar
- file:/System/Library/Java/Extensions/dns_sd.jar
- file:/System/Library/Java/Extensions/j3daudio.jar
- file:/System/Library/Java/Extensions/j3dcore.jar
- file:/System/Library/Java/Extensions/j3dutils.jar
- file:/System/Library/Java/Extensions/jai_codec.jar
- file:/System/Library/Java/Extensions/jai_core.jar
- file:/System/Library/Java/Extensions/libAppleScriptEngine.jnilib
- file:/System/Library/Java/Extensions/libJ3D.jnilib
- file:/System/Library/Java/Extensions/libJ3DAudio.jnilib
- file:/System/Library/Java/Extensions/libJ3DUtils.jnilib
- file:/System/Library/Java/Extensions/libmlib_jai.jnilib
- file:/System/Library/Java/Extensions/libQTJNative.jnilib
- file:/System/Library/Java/Extensions/libShark.jnilib
- file:/System/Library/Java/Extensions/mlibwrapper_jai.jar
- file:/System/Library/Java/Extensions/MRJToolkit.jar
- file:/System/Library/Java/Extensions/QTJava.zip
- file:/System/Library/Java/Extensions/vecmath.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s