0

i.e. I need to get path of the directory from where my classes are loaded.

user626528
  • 13,999
  • 30
  • 78
  • 146

1 Answers1

0

The last answer from this thread: How to get classpath from classloader? may be what you want:

ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
for (URL url: urls) {
    System.out.println(url.getFile());
}
Community
  • 1
  • 1
StephaneM
  • 4,779
  • 1
  • 16
  • 33