Skip to content

Instantly share code, notes, and snippets.

@isapir
Created June 23, 2012 21:53
Show Gist options
  • Save isapir/2980206 to your computer and use it in GitHub Desktop.
Save isapir/2980206 to your computer and use it in GitHub Desktop.
prints a list of jars found in a class path of a class loader
<cffunction name="printClassLoaderUrls" output="true">
<cfargument name="classLoader">
<cfset var Local = {}>
<cfset PAD = "&nbsp;&nbsp;&nbsp;&nbsp;">
<p><b>#classLoader.getClass().getCanonicalName().toString()#</b>
<cftry>
<cfset Local.urls = classLoader.getURLs()>
<cfloop array="#Local.urls#" index="Local.ai">
<br>#PAD# #Local.ai.toString()#
</cfloop>
<cfcatch>
<p class="error">#PAD# #cfcatch.toString()#; passed classLoader does not have a getURLs() method</p>
<cfdump var="#classLoader#" label="classLoader">
</cfcatch>
</cftry>
</cffunction>
<cfset printClassLoaderUrls( getPageContext().getClass().getClassLoader().getSystemClassLoader() )>
<cfset printClassLoaderUrls( getPageContext().getServlet().getClass().getClassLoader() )>
<cfset printClassLoaderUrls( getPageContext().getConfig().getClassLoader() )>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment