Here you can find the source of getClassPath()
public static String getClassPath()
//package com.java2s; import java.net.URL; public class Main { public static String getClassPath() { String classpath = ""; URL resource = Thread.currentThread().getContextClassLoader().getResource(""); if (resource != null) { classpath = resource.getPath(); }/*w w w . j a va2 s. c o m*/ return classpath; } }