ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: [OT] getting name of launch jar
Date Thu, 05 Dec 2002 22:42:49 GMT
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.

Note that since the question was about java -jar my.jar, both points above
are moot since the class comes from a JAR, and if it's part of that JAR,
will be loaded from the System class loader ;-) Nevertheless, I don't think
it's the recommended way to do it. --DD

-----Original Message-----
From: Gordon Tyler [] 
Sent: Thursday, December 05, 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 = 


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message