Skip to content

Instantly share code, notes, and snippets.

@wytten
Created April 9, 2013 16:51
Show Gist options
  • Save wytten/5347343 to your computer and use it in GitHub Desktop.
Save wytten/5347343 to your computer and use it in GitHub Desktop.
How can I find out from where my class is loaded? Source: http://www.coderanch.com/how-to/java/Java-FAQ
import java.security.ProtectionDomain;
ProtectionDomain protectionDomain = getClass().getProtectionDomain();
File codeLoc = new File(protectionDomain.getCodeSource().getLocation().getFile());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment