Return to Snippet

Revision: 14970
at June 18, 2009 15:48 by macbeth76


Initial Code
import java.net.URL;
import java.net.URLClassLoader;

public class PrintClasspath {
    public static void main(String[] args) {

        //Get the System Classloader
        ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();

        //Get the URLs
        URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();

        for(int i=0; i< urls.length; i++)
        {
            System.out.println(urls[i].getFile());
        }       

    }
}

Initial URL
http://www.java-tips.org/java-se-tips/java.lang/how-to-print-classpath.html

Initial Description

                                

Initial Title
Java Tips - How to print classpath

Initial Tags

                                

Initial Language
Java