/ Published in: Java
The returned file will either contain the folder from where your program is running or the executable jar file, if your program is an executable jar.
I'm using `Main.class` because this code is in my main method (which is in the class 'Main'). You can replace `Main.class` by `getClass()` if you want to use this code in a non-static method.
I'm using `Main.class` because this code is in my main method (which is in the class 'Main'). You can replace `Main.class` by `getClass()` if you want to use this code in a non-static method.
Expand |
Embed | Plain Text
URL: http://www.velocityreviews.com/forums/t147526-how-to-get-jar-file-name.html