Created
November 29, 2015 07:09
-
-
Save claytantor/9bd3e94b164e63a318a4 to your computer and use it in GitHub Desktop.
A way to determine current filesystem location of executed class from the code of this class, in runtime, given that it's executed using java command.
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
final File f = new File( | |
MyClass.class | |
.getProtectionDomain() | |
.getCodeSource() | |
.getLocation().getPath()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment