Skip to content

Instantly share code, notes, and snippets.

@stevebakh
Created May 4, 2018 12:34
Show Gist options
  • Select an option

  • Save stevebakh/c5fa6097053f1739304d5b8a6754671d to your computer and use it in GitHub Desktop.

Select an option

Save stevebakh/c5fa6097053f1739304d5b8a6754671d to your computer and use it in GitHub Desktop.
Find the filepath of the jar containing a particular class
// without instance:
classOf[SomeClass].getProtectionDomain.getCodeSource.getLocation.toURI.getPath
// with instance:
someClassInstance.getClass.getProtectionDomain.getCodeSource.getLocation.toURI.getPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment