| Author |
How to get the running jar path?
|
Jean-Yves Tinevez
Greenhorn
Joined: Feb 12, 2007
Posts: 22
|
|
Hi all! I am trying very hard to get the jar path of the currently running application. Simply because i have a resource folder that i would like to distribute along with the jar itself. (It couldn't work to put these resources directly *in* the jar, for it is a folder that must be listed and edited and modified by the user). As i would like to distribute the jar, i would like to specify the path to this folder in a kind of robust manner, for example, try to say to the class: "look for where the jar is, the folder should be there". But i couldn't find a proper way to do it. For example, if i specify i get the path of something *inside* the jar.... Any idea how to do that nicely? By the way, how do you manage with this kind of deployment issue? Bests [ August 20, 2007: Message edited by: Jean-Yves Tinevez ]
|
 |
Paul Santa Maria
Ranch Hand
Joined: Feb 24, 2004
Posts: 236
|
|
Hi - Have you considered querying "user.dir" or "java.class.path"? For example: Here are a few links that might help: http://www.devx.com/tips/Tip/13804 http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html http://forum.java.sun.com/thread.jsp?forum=22&thread=405160&tstart=0&trange=100 'Hope that helps .. PSM
|
Paul M. Santa Maria, SCJP
|
 |
Jean-Yves Tinevez
Greenhorn
Joined: Feb 12, 2007
Posts: 22
|
|
Originally posted by Paul Santa Maria: [QB] Have you considered querying "user.dir" or "java.class.path"? For example:
Yes, I have tried. "user.dir" only gives the directory from where the application was launched, not the one where it lives. "java.class.path" gives me all kind of path... Thank you anyway. I have looked deeply on the internet and couldn't find a concise answer....
|
 |
Israel Rios
Greenhorn
Joined: Sep 19, 2007
Posts: 1
|
|
|
There is some explanation about this subject available on http://forum.java.sun.com/thread.jspa?threadID=5153353&messageID=9577541
|
 |
 |
|
|
subject: How to get the running jar path?
|
|
|