Print classpath : URLClassLoader « Development Class « Java






Print classpath

 

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());
    }
  }
}

   
  








Related examples in the same category

1.Load a Class that is not on the classpath