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


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

Re: How to print out the currently used JAR file path to verify it is using right JAR?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Joshua Cranmer <Pidgeot18@verizon.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: How to print out the currently used JAR file path to verify it is using right JAR?
Date Fri, 07 Oct 2011 10:18:02 -0500
Organization A noiseless patient Spider
Lines 18
Message-ID <j6n57d$s6$1@dont-email.me> (permalink)
References <4d7daeb4-7da7-47c0-a4cf-d3c5d1be2ef0@gd10g2000vbb.googlegroups.com> <13afa738-1198-4569-84be-9fc6627c52d6@t16g2000yqm.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 7 Oct 2011 15:18:05 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="WpcHJSul77m+zlbR9GVqkA"; logging-data="902"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xf7m09IlEF+3z8LPfkjD/+k19hIPBAjo="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
In-Reply-To <13afa738-1198-4569-84be-9fc6627c52d6@t16g2000yqm.googlegroups.com>
Cancel-Lock sha1:YaSYflAooV5ZFs6SIhZQ0W55H2g=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8627

Show key headers only | View raw


On 10/7/2011 9:25 AM, www wrote:
> Just to add more details about my question:
>
> In my code, I am using class Abc, which is from 3rd party JAR
> file(MyJAR.jar). I hope to print out Abc's class path to see it is
> from a/b/MyJAR.old.jar or from c/d/MyJAR.new.jar
>
> I understand the correct way is to check the classpath and which JAR
> is front is the one to be used. However, we run into some strange
> things here and that method didn't solve the problem.

One way, which I don't know if it would work, would be:
System.out.println(Abc.class.getClassLoader().findResource(
   "com/foo/package/Abc.class").toString());

-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. -- Donald E. Knuth

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


Thread

How to print out the currently used JAR file path to verify it is using right JAR? www <xsli2@yahoo.com> - 2011-10-07 06:56 -0700
  Re: How to print out the currently used JAR file path to verify it is using right JAR? www <xsli2@yahoo.com> - 2011-10-07 07:25 -0700
    Re: How to print out the currently used JAR file path to verify it is using right JAR? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-10-07 10:18 -0500
      Re: How to print out the currently used JAR file path to verify it is using right JAR? www <xsli2@yahoo.com> - 2011-10-07 08:30 -0700
    Re: How to print out the currently used JAR file path to verify it is using right JAR? markspace <-@.> - 2011-10-07 08:39 -0700
      Re: How to print out the currently used JAR file path to verify it is using right JAR? Lew <lewbloch@gmail.com> - 2011-10-07 08:47 -0700
      Re: How to print out the currently used JAR file path to verify it is using right JAR? www <xsli2@yahoo.com> - 2011-10-07 09:37 -0700
        Re: How to print out the currently used JAR file path to verify it is using right JAR? markspace <-@.> - 2011-10-07 11:17 -0700
          Re: How to print out the currently used JAR file path to verify it is using right JAR? www <xsli2@yahoo.com> - 2011-10-07 11:37 -0700
  Re: How to print out the currently used JAR file path to verify it is using right JAR? Roedy Green <see_website@mindprod.com.invalid> - 2011-10-07 10:50 -0700
    Re: How to print out the currently used JAR file path to verify it is using right JAR? www <xsli2@yahoo.com> - 2011-10-07 11:00 -0700

csiph-web