Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to get the running jar path?

 
Greenhorn
Posts: 22
Mac Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jean-Yves Tinevez
Greenhorn
Posts: 22
Mac Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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....
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is some explanation about this subject available on http://forum.java.sun.com/thread.jspa?threadID=5153353&messageID=9577541
 
Can you hear that? That's my theme music. I don't know where it comes from. Check under this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic