Here you can find the source of getClassPath()
public static String getClassPath()
//package com.java2s; //License from project: Open Source License import java.net.URL; import java.net.URLClassLoader; public class Main { public static String getClassPath() { StringBuffer buf = new StringBuffer(); ClassLoader cl = ClassLoader.getSystemClassLoader(); URL[] urls = ((URLClassLoader) cl).getURLs(); for (URL url : urls) { if (buf.length() > 0) buf.append(";"); buf.append(url.getFile());/*from w w w .j av a2s .co m*/ } return buf.toString(); } }