Problem running as JAR

Hai all,

I have an appliaction (JFrame) which run fine when i directly call it using java classname....

But i cant run it as a executable jar file. I am getting the following error message

////////////////////////////////////////////////////////////////////////////////

Uncaught error fetching image:

java.lang.NullPointerException

at sun.awt.image.URLImageSource.getConnection(Unknown Source)

at sun.awt.image.URLImageSource.getDecoder(Unknown Source)

at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)

at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)

at sun.awt.image.ImageFetcher.run(Unknown Source)

////////////////////////////////////////////////////////////////////////////////

I gave some debug messages and found that excpetion is occuring at the line that call the "show" method of the JFrame. I am trying to load some images in it. I used the following method for it

/////////////////////////////////////////////////////////////

try

{

Image icon=Toolkit.getDefaultToolkit().getImage(this.getClass().getClassLoader().getResource (path+"logo.gif")) ;

this.setIconImage(icon);

}

catch(Exception rt)

{

System.out.println("Error while loading image");

}

/////////////////////////////////////////////////////////////

I hope that the above method is right.

Thanks in advance,

joe

[1481 byte] By [jose_sam] at [2007-9-26 21:00:41]
# 1

How did you create your JAR? It sounds like it does not contain all of the classes you are trying to execute and your classpath is not set up properly for the execution to find them like it does when running from the command line.

Also are you invoking the JAR from a command line java -jar xxxxx ?

darted at 2007-7-3 20:11:07 > top of Java-index,Core,Core APIs...
# 2
Sounds like you have a problem fetching the image from the jar file (I assume you want to get an image from the jar). What is the contents of 'path'?
abnormal at 2007-7-3 20:11:07 > top of Java-index,Core,Core APIs...