Here you can find the source of toClasspathString(ClassLoader cl)
public static String toClasspathString(ClassLoader cl) throws Exception
//package com.java2s; //License from project: LGPL import java.io.File; import java.net.URL; import java.net.URLClassLoader; public class Main { public static String toClasspathString(ClassLoader cl) throws Exception { if (cl == null) { cl = Thread.currentThread().getContextClassLoader(); }/*from w w w.ja va2 s .c o m*/ StringBuilder back = new StringBuilder(); while (cl != null) { if (cl instanceof URLClassLoader) { URLClassLoader ucl = (URLClassLoader) cl; URL[] urls = ucl.getURLs(); for (URL url : urls) { if (back.length() != 0) { back.append(File.pathSeparatorChar); } back.append(url.getFile()); } } cl = cl.getParent(); } return back.toString(); } }