-
-
Save yafevin/d83c92a95076fe00c85f266f2ceed66f to your computer and use it in GitHub Desktop.
get classpath from classloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.URL; | |
import java.net.URLClassLoader; | |
public class SeeClassPath { | |
public static void main(String[] args) { | |
getClasspathFromClassloader(); | |
} | |
static void getClasspathFromClassloader() { | |
ClassLoader cl = ClassLoader.getSystemClassLoader(); | |
URL[] urls = ((URLClassLoader) cl).getURLs(); | |
for (URL url : urls) { | |
System.out.println(url.getFile()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment