Dominique Devienne wrote:
PS: You still assume the class is coming from a JAR. I'd have to check
myClassURL to see if it's file: based, http: based, jar: based, etc... And
you'd have to deal with inner classes in a.B$C, etc... It gets complex.
Since the original question was about "java -jar mya
sed, jar: based, etc... And
you'd have to deal with inner classes in a.B$C, etc... It gets complex.
-Original Message-
From: Gordon Tyler [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 4:55 PM
To: Ant Users List
Subject: Re: [OT] getting name of launch jar
Dominique Devien
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.
eve's L. trick of doing
someClass.getProtectionDomain().getCodeSource().getLocation().
--DD
-Original Message-
From: Laurie Harper [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 4:11 PM
To: [EMAIL PROTECTED]
Subject: [OT] getting name of launch jar
(I know this is off
5, 2002 4:32 PM
To: Ant Users List
Subject: Re: [OT] getting name of launch jar
We use the following trick:
String className = MyClass.class.getName();
URL myClassUrl = ClassLoader.getSystemResource(className.replace('.',
'/') + ".class");
URL jarUrl =
I learned it from you, so for me it's your trick ;-)
Nice of you to give credit where it's due of course. --DD
-Original Message-
From: Steve Loughran [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 4:28 PM
To: Ant Users List
Subject: Re: [OT] getting name of
We use the following trick:
String className = MyClass.class.getName();
URL myClassUrl = ClassLoader.getSystemResource(className.replace('.',
'/') + ".class");
URL jarUrl =
((JarURLConnection)myClassUrl.openConnection()).getJarFileURL();
Ciao,
Gordon
Laurie Harper wrote:
(I know this is off-to
- Original Message -
From: "Dominique Devienne" <[EMAIL PROTECTED]>
To: "'Ant Users List'" <[EMAIL PROTECTED]>
Sent: Thursday, December 05, 2002 2:13 PM
Subject: RE: [OT] getting name of launch jar
> I believe Java puts the path of that JAR
2002 4:11 PM
To: [EMAIL PROTECTED]
Subject: [OT] getting name of launch jar
(I know this is off-topic for this list, but I need to find an answer
fast or change approach so I was hoping someone might be able to give me
a pointer!)
I've got an application which is packaged as a single jar, l
(I know this is off-topic for this list, but I need to find an answer
fast or change approach so I was hoping someone might be able to give me
a pointer!)
I've got an application which is packaged as a single jar, launched by
'java -jar myapp.jar'. The problem is I need to be able to get the pa
10 matches
Mail list logo