Saturday, 23 April 2016

How can I find from where my class is loaded ?


Checking the location of .class file
 
import java.security.ProtectionDomain;

ProtectionDomain protectionDomain = 
                   getClass().getProtectionDomain();
File location = 
 new File(protectionDomain.getCodeSource().getLocation().getFile());

No comments:

Post a Comment

Note: only a member of this blog may post a comment.