Created
January 11, 2014 20:15
-
-
Save jessitron/8376139 to your computer and use it in GitHub Desktop.
scala: print all URLs on classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.filterNot(_.toString.contains("ivy")).mkString("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Handy! Thank you. There's a missing paren on the last line. Check out my fork: https://gist.github.com/rgorsuch/b404c658551a6a8aeb35