aspose file tools*
The moose likes Java in General and the fly likes GIF image not getting displayed from an executable jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "GIF image not getting displayed from an executable jar" Watch "GIF image not getting displayed from an executable jar" New topic
Author

GIF image not getting displayed from an executable jar

Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
Hi

There is a GIF image in my executable jar. On running this jar, its not displaying the logo. Do i need to point to this gif from my MANIFEST filem, if yes please let me know how to do so
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Originally posted by Srinivasa Maddi:
Hi

There is a GIF image in my executable jar. On running this jar, its not displaying the logo. Do i need to point to this gif from my MANIFEST filem, if yes please let me know how to do so


How are you loading the image?
I have found out in the past that logo.GIF and logo.gif are not the same. So you need to check your case.
No. You do not require any entry in the manifest unless you want to display it as a splash screen.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
Hi Manish

My app is displaying the logo before packing it into jar format. Though its running after jar'ing it, its not displaying the logo.

- - -
ImageIcon icon = createImageIcon("./Logo.gif",null);
lLogo = new JLabel(icon);
- - -
- - -
/** Returns an ImageIcon, or null if the path was invalid. */
protected ImageIcon createImageIcon(String path,String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Does this get printed?
Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
No
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Originally posted by Srinivasa Maddi:
No


Can you post asscce code so we can try and figure out whats going wrong.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42612
    
  65
Remove the dot from "./Logo.gif"; it has no place in a path specification like this.

Is the file located at the root of the jar file? That's what "/" means.


Ping & DNS - my free Android networking tools app
Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
Thank you all

Its working perfectly since i removed . and / too and hence using only "Logo.gif". Thanks again

Javaranch is really useful and moreover i am getting prompt responses these days
[ October 22, 2008: Message edited by: Srinivasa Maddi ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: GIF image not getting displayed from an executable jar