Skip to content

Instantly share code, notes, and snippets.

@nshaw
Created June 25, 2014 15:52
Show Gist options
  • Save nshaw/1490672be3450503d2c4 to your computer and use it in GitHub Desktop.
Save nshaw/1490672be3450503d2c4 to your computer and use it in GitHub Desktop.
Show the location of a class as loaded by the JVM
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