Here you can find the source of getClasspath()
public static List<URL> getClasspath()
//package com.java2s; //License from project: Apache License import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; public class Main { public static List<URL> getClasspath() { ArrayList<URL> classpath = new ArrayList<URL>(); ClassLoader cl = ClassLoader.getSystemClassLoader(); URL[] urls = ((URLClassLoader) cl).getURLs(); for (URL url : urls) { classpath.add(url);/* w w w . ja v a2s . c om*/ } return classpath; } }