Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@apache.org Received: (qmail 46632 invoked from network); 5 Dec 2002 22:55:07 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 5 Dec 2002 22:55:07 -0000 Received: (qmail 29435 invoked by uid 97); 5 Dec 2002 22:56:09 -0000 Delivered-To: qmlist-jakarta-archive-ant-user@jakarta.apache.org Received: (qmail 29416 invoked by uid 97); 5 Dec 2002 22:56:08 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 29404 invoked by uid 98); 5 Dec 2002 22:56:08 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <3DEFD93F.5060104@sitraka.com> Date: Thu, 05 Dec 2002 17:54:55 -0500 From: Gordon Tyler Organization: Sitraka User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-ca, en-us, en MIME-Version: 1.0 To: Ant Users List Subject: Re: [OT] getting name of launch jar References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Dominique Devienne wrote: > Which kind of breaks down if the class is not loaded from the System class > loader, but a child loader of it (or a child loader of a parent of the > system loader), and if the class is loaded from a classes/ directory. Indeed. That wasn't an issue for our particular case. The following may work for those situations: String className = MyClass.class.getName(); URL myClassUrl = MyClass.class.getResource("/" + className.replace('.', '/') + ".class"); URL jarUrl = ((JarURLConnection)myClassUrl.openConnection()).getJarFileURL(); I think. > Nevertheless, I don't think > it's the recommended way to do it. --DD Why not? What recommends the getProtectionDomain method over this one? Ciao, Gordon -- Gordon Tyler Software Developer, R&D Sitraka (now part of Quest Software) "Performance is Mission Critical" -- To unsubscribe, e-mail: For additional commands, e-mail: