Re: [Java-gnome-developer] Image handling URL
Brought to you by:
afcowie
From: Joao V. <jvi...@ya...> - 2005-05-12 15:00:15
|
--- pancake <pa...@ph...> escreveu: > Nope, I want to load a file inside the same jar that Gdvb class. The main problem is that I have > to put the .jar in the CLASSPATH and execute the Gdvb class instead of java -jar gdvb.jar, > because in this second form, java only handles the classpath defined in the MANIFEST. And I > don't want to define the gtk jar file path there. Because is system-dependent. Sure; you can do that with Class.loadResource. That method will search the app CLASSPATH to find what you're looking for. If you got this structure inside the jar, for example: /org.pancake (...) -- here goes your source /resources -- here goes stuff I think you can load the resources you want this way: getClass().getResource("/resources/stuff.conf"); The "/" in the beginning is essencial here, as this method works with relative paths (so putting "/" tells it to search from the root of the CLASSPATH's dirs). Cheers, J.V. __________________________________________________ Converse com seus amigos em tempo real com o Yahoo! Messenger http://br.download.yahoo.com/messenger/ |