Skip to content

Instantly share code, notes, and snippets.

@dirkgr
Created July 3, 2014 23:12
Show Gist options
  • Save dirkgr/20a00d30522c1381f0e2 to your computer and use it in GitHub Desktop.
Save dirkgr/20a00d30522c1381f0e2 to your computer and use it in GitHub Desktop.
Print class path in Scala
def urlses(cl: ClassLoader): Array[java.net.URL] = cl match {
case null => Array()
case u: java.net.URLClassLoader => u.getURLs() ++ urlses(cl.getParent)
case _ => urlses(cl.getParent)
}
val urls = urlses(getClass.getClassLoader)
println(urls.mkString("\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment