Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #23025

Re: Getting path to jar passed on command line

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date Thu, 21 Mar 2013 08:49:00 -0400
From Arne Vajhøj <arne@vajhoej.dk>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4
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> <QoqdnbXcXNBzY9fMnZ2dnUVZ7o-dnZ2d@bt.com>
In-Reply-To <QoqdnbXcXNBzY9fMnZ2dnUVZ7o-dnZ2d@bt.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Lines 24
Message-ID <514b01be$0$32115$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source
NNTP-Posting-Host 72.192.23.141
X-Trace news.sunsite.dk DXC=LiFBE0G60o]D]J=fIXJe6_YSB=nbEKnk[O5A8C=`f[dQ[3=]\_16Q0_TYcHEIhNcYXUJ[^3k1A0GXi2XV[5gi2hWXmneO5ZnkV\
X-Complaints-To staff@sunsite.dk
Xref csiph.com comp.lang.java.programmer:23025

Show key headers only | View raw


On 3/21/2013 8:37 AM, lipska the kat wrote:
> 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>
>>
>
> You could try
>
> RuntimeMXBean rtmxb = ManagementFactory.getRuntimeMXBean();
> List<String> inArgs = rtmxb.getInputArguments();
>
> although the documentation seems to suggest that what is actually
> passed to the Runtime bean is dependent on the particular implementation
> of the jvm you happen to be using.

He could try it.

But I think he will have better luck with rtmxb.getClassPath().

Arne

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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