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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to