Skip to content

Instantly share code, notes, and snippets.

@yashk
Created May 31, 2011 15:11
Show Gist options
  • Save yashk/1000667 to your computer and use it in GitHub Desktop.
Save yashk/1000667 to your computer and use it in GitHub Desktop.
loaction of jar file a class is loaded from
Class cls = this.getClass();
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc = cSource.getLocation(); // file:/c:/almanac14/examples/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment