ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Tyler <>
Subject Re: [OT] getting name of launch jar
Date Thu, 05 Dec 2002 22:32:03 GMT
We use the following trick:

String className = MyClass.class.getName();
URL myClassUrl = ClassLoader.getSystemResource(className.replace('.', 
'/') + ".class");
URL jarUrl = 


Laurie Harper wrote:
> (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 path 
> and file-name of the jar file.
> Does anyone know if there is a way to do this?
> Thanks,
> L.

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: <>

View raw message