0 Replies - 261 Views - Last Post: 01 May 2010 - 05:09 AM Rate Topic: -----

#1 soltan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 13-July 08

Img not showing when using jar

Posted 01 May 2010 - 05:09 AM

Hello guys!

I am having a problem packaging my jar , it not showing any img and after some research i found that i should use the following.
 java.net.URL imgURL = getClass().getResource("image.jpg");
     if(imgURL != null)
     {
    	 displayImage =  Toolkit.getDefaultToolkit().getImage(imgURL); 
     }


however i think i am not setting the path correctly here because the img is in res file in my project and it runs fine under eclipse run but not in jar file , i also inspected the jar file and didn't find the res folder even though i specified the res folder to be added in source in build path.

help is appreciated !

Is This A Good Question/Topic? 0
  • +

Page 1 of 1