Print classpath : URLClassLoader « Class Definition « Java Tutorial






import java.net.URL;
import java.net.URLClassLoader;

public class Main {
  public static void main(String[] args) {
    ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();
    URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();
    for (int i = 0; i < urls.length; i++) {
      System.out.println(urls[i].getFile());
    }
  }
}








5.35.URLClassLoader
5.35.1.Load a Class that is not on the classpath
5.35.2.Print classpath