Re: [Java-gnome-developer] Image handling URL
Brought to you by:
afcowie
From: Nicholas R. <ni...@mn...> - 2005-05-12 15:32:55
|
On Thu, 2005-05-12 at 16:34 -0400, pancake wrote: > On Wed, 11 May 2005 21:38:46 -0300 (ART) > Joao Victor <jvi...@ya...> wrote: > > > --- pancake <pa...@ph...> escreveu: > > > I found a problem in JavaGnome API....it seems that it's impossible to handle files inside a > > > JAR. > > > > > > The right way to do it is using > > > > > > URL xxx = this.getClass().getResource("icons/gdvb.png"); > > > > > > This returns an url like: jar:file://path/to/jar!path/to/file > > > > That's correct... but that isn't Java-Gnome's funcionality anymore, that's just java. But i didn't > > understand very well what you want to do: > > > > You want a class inside a jar to load a file which is outside the jar? Is that right? Well, either > > case, take a look at this page: > > 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. > This is unfortunately true. We generate platform dependent JAR files. This is something i hope to fix for the next version. It has to do with the way automake names libraries on different platforms. My JG application can load resources from within my jar file (actually, i use getResourceAsStream to load a glade file) when I run it with java -jar myapp.jar. I have even made a zip file which contains the JG jars, my jar, config files and execution script. The problem for me is that I can't just have one zip file for all platforms. I have to create one specifically for windows in order to include the correct JARs. If the JARs were platform independent, i would only need one zip file for everyone. nick |