source

fun <T : Any> Class<T>.source(tempDir: File = File(tmpDir)): File

Acquire the JAR-file which contains this class. If JAR-file is a nested JAR-file, meaning the class is inside a JAR-file inside another JAR-file, then said nested JAR-file will be extracted to the specified directory, or your systems temp-directory, and that file will be returned by this method.

In any case the returned file will give you access to the JAR-file which contains class from which this method was called, unless the class itself is nested more than one layer deep.

Author

Griefed

Parameters

rootOnly

Whether only the root of the parent JAR-file should be considered, ignoring potential nesting of the class.

tempDir

The directory to which a nested JAR-file will be extracted to. If not specified, your systems default temp-directory will be used.