How do I get the directory that the currently executing jar file is in? [duplicate]

Not a perfect solution but this will return class code base’s location:

getClass().getProtectionDomain().getCodeSource().getLocation()

Leave a Comment