Created
June 25, 2014 15:52
-
-
Save nshaw/1490672be3450503d2c4 to your computer and use it in GitHub Desktop.
Show the location of a class as loaded by the JVM
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.security.CodeSource | |
import com.liferay.portlet.dynamicdatamapping.storage.BaseStorageAdapter; | |
try { | |
// Change this to whatever class you want to inspect | |
Class clazz = BaseStorageAdapter.class; | |
CodeSource src = BaseStorageAdapter.class.getProtectionDomain().getCodeSource(); | |
if (src != null) { | |
println clazz.getSimpleName() + " is sourced here: "+ src | |
} | |
else { | |
println "Couldn't find class" | |
} | |
} | |
catch (Exception e) { | |
println "Script failed: " + e; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment