ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Bukanov <i...@fastmail.fm>
Subject Re: Problem running executable jar - classpath issues
Date Thu, 24 Jul 2003 10:09:36 GMT
Duffey, Kevin wrote:
> I would, but then the getClass().getClassLoader().getResource() doesn't work because
it is looking for resources that are only contained in the jar file, pulled from another directory.
That was actually working until the error came up with the above code!

Instead of using getClass().getClassLoader().getResource() in a code 
that will go to a separated jar to access /image provided by the 
application which may or may not find /image depending on which class 
loader is used to load getClass(), try to pass the loader that loads the 
main class of your application to your library and use it instead of 
getClass().getClassLoader().

You can also try to use 
Thread.currentThread().getContextClassLoader().getResource() since if 
you do not change it, Thread.currentThread().getContextClassLoader() 
will be exectly the classloader that loaded your application main class 
and knows about /image at least with Sun JDK.

Regards, Igor


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message