Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Bertha Ferguson   on Jul 29 In Java Category.

  
Question Answered By: Edfu Massri   on Jul 29

Have you tried using the getResource function?
If you do something like this:

public class  Class1 {
...
URL imageURL = this.getClass().getResource("image.gif");
ImageIcon icon = new ImageIcon(imageURL);
...
}

the file  called image.gif is assumed to be located in the root
directory of the jar  that contains Class1.class.

Share: