I am trying to get the absolute path (as a String) of the directory where the jar file is located. The jar file is executed with an application from another directory.
For this example, let us assume I have a jar file called Test.jar and it is located in C:\TestFolder\
. How do I get this full path C:\TestFolder\
, not the path of the application executing the jar? I tried using the System.getProperty("user.dir")
but this did not work.
Asked
Active
Viewed 98 times
4

Paul Vargas
- 41,222
- 15
- 102
- 148

jadrijan
- 1,438
- 4
- 31
- 48
-
2http://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file is not what you need? – Full Frontal Nudity May 22 '13 at 19:57
-
1Does your application know the name of the jar or do you mean the jar from which the application was loaded? – mschenk74 May 22 '13 at 19:57
-
What are you actually trying to ***achieve*** by knowing that path? – Andrew Thompson May 22 '13 at 23:50