Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23029
| NNTP-Posting-Date | Thu, 21 Mar 2013 08:41:47 -0500 |
|---|---|
| Date | Thu, 21 Mar 2013 13:41:46 +0000 |
| From | lipska the kat <"nospam at neversurrender dot co dot uk"> |
| Organization | Trollbusters 3 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Getting path to jar passed on command line |
| References | <98cfa140-0b4a-476a-bf1c-9cc2c39f22d8@googlegroups.com> |
| In-Reply-To | <98cfa140-0b4a-476a-bf1c-9cc2c39f22d8@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Message-ID | <fdidnd_45PyGk9bMnZ2dnUVZ8kadnZ2d@bt.com> (permalink) |
| Lines | 24 |
| X-Usenet-Provider | http://www.giganews.com |
| X-AuthenticatedUsername | NoAuthUser |
| X-Trace | sv3-yUYrkZAb5AYeHsNOoRiqQv7ikTbyRWRuulEifj7AF57vFKqJsBKhaASYT8YTQc38fNAmDjeRxXRS+wU!GCuR1f8aidOUmFLmkNImTmHrnPcD+6sGS6pFEo7wsXZ/vcFrh2MIF29/fRogWQOprAhVepUsZi4= |
| X-Complaints-To | abuse@btinternet.com |
| X-DMCA-Complaints-To | abuse@btinternet.com |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 1935 |
| Path | csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail |
| Xref | csiph.com comp.lang.java.programmer:23029 |
Show key headers only | View raw
On 21/03/13 10:55, raphfrk@gmail.com wrote: > Is there a way to get the path of the jar file that was passed on the command line? > > java -jar<some path> > http://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file Gives some good advice The solution String path = Test.class.getProtectionDomain().getCodeSource().getLocation().getPath(); String decodedPath = URLDecoder.decode(path, "UTF-8"); Works for me and gives me the path to the jar file containing the class that contains the above code. lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Getting path to jar passed on command line raphfrk@gmail.com - 2013-03-21 03:55 -0700
Re: Getting path to jar passed on command line lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-21 12:37 +0000
Re: Getting path to jar passed on command line Arne Vajhøj <arne@vajhoej.dk> - 2013-03-21 08:49 -0400
Re: Getting path to jar passed on command line Arne Vajhøj <arne@vajhoej.dk> - 2013-03-21 08:55 -0400
Re: Getting path to jar passed on command line lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-21 13:41 +0000
Re: Getting path to jar passed on command line raphfrk@gmail.com - 2013-03-22 09:57 -0700
Re: Getting path to jar passed on command line Roedy Green <see_website@mindprod.com.invalid> - 2013-03-21 14:11 -0700
Re: Getting path to jar passed on command line Arne Vajhøj <arne@vajhoej.dk> - 2013-03-21 17:31 -0400
csiph-web