Skip to content

Instantly share code, notes, and snippets.

@stianl
Created August 28, 2014 07:59
Show Gist options
  • Save stianl/426788abc17a4245665d to your computer and use it in GitHub Desktop.
Save stianl/426788abc17a4245665d to your computer and use it in GitHub Desktop.
Get where class was loaded from
// http://stackoverflow.com/questions/1983839/determine-which-jar-file-a-class-is-from
Class klass = String.class;
URL location = klass.getResource('/'+klass.getName().replace('.', '/')+".class");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment