Skip to content

Instantly share code, notes, and snippets.

@brake
Created February 14, 2019 13:06
Show Gist options
  • Save brake/efae5d03aa14e7ba7cb448ec66e69b30 to your computer and use it in GitHub Desktop.
Save brake/efae5d03aa14e7ba7cb448ec66e69b30 to your computer and use it in GitHub Desktop.
Get executable jar path on Kotlin
fun getExecutablePath(): File? =
Paths.get(object {}.javaClass.protectionDomain.codeSource?.location?.toURI()).parent.toFile()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment