Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23026
| Date | 2013-03-21 08:55 -0400 |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Getting path to jar passed on command line |
| References | <98cfa140-0b4a-476a-bf1c-9cc2c39f22d8@googlegroups.com> |
| Message-ID | <514b0332$0$32116$14726298@news.sunsite.dk> (permalink) |
| Organization | SunSITE.dk - Supporting Open source |
On 3/21/2013 6:55 AM, 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> Given how many different ways there are to get your code activated (java -jar, java -cp, wrapper main), then my recommendation would be: NameOfYourClass.class.getProtectionDomain().getCodeSource().getLocation().getPath() as this will locate where that class is being loaded from no matter how it gets activated. Arne
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