I have a JAR and it contains a directory called icons that contains all my image icons for my application. I am running jdk 1.4.0 and here is the code that is compiling but not running:
Now when I run the applicationa and it gets to this point in the program to load the image this is the error that I get
Can someone help me see the light here? Thanks. If you need any more information let me know. It is telling me this nullpointerexception on the line Image image = getClass()....... Thanks again.
This is a slightly educated guess, but try replacing the line:
with
Also, make sure your jar file is in the classpath and that inside of the jar file, the file icons/connect16.gif really exists. I had problems getting images out of a jar file a while back and the slash at the beginning (just before icons) did the trick for me. Let me know how it goes... Randy
Randy, thanks for the guess, but that is not the problem. What I should mention is the fact that it DID work under jdk 1.3 and now with jdk 1.4 it does not.
That pretty much sums it up Nathan. That pretty much scroggs either me using jdk 1.4 or from storing images in my jar file. I am not going to parse my URL the way they suggest. Seems like too much overhead. I think I will just store the images externally. Thanks for your reply Nathan. You always have the answers.
We find this kind of rampant individuality very disturbing. But not this tiny ad:
a bit of art, as a gift, that will fit in a stocking