Discussion:
Absolute Path where the main() resides
(too old to reply)
Eric Orilla
2005-03-30 04:09:44 UTC
Permalink
Hi there,

I want to get the full path of the jar file containing my main() function, any info is appreciated!

Thank you
Shankar Unni
2005-03-30 18:17:39 UTC
Permalink
Post by Eric Orilla
I want to get the full path of the jar file containing my main() function
One of those trivia that I couldn't even Google for easily, so I bit
back my automatic suggestion.

Answer:

Class.getProtectionDomain().getCodeSource().getLocation()

Get the class object for your class, and call the above. You'll get a
URL to the location. (Remember, classes and jars can also be loaded over
the net..)
John McGrath [TeamB]
2005-03-30 21:32:28 UTC
Permalink
Post by Eric Orilla
I want to get the full path of the jar file containing my main()
function, any info is appreciated!
http://www.visi.com/~gyles19/fom-serve/cache/391.html
--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Loading...