Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes display icon for core java executable jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "display icon for core java executable jar" Watch "display icon for core java executable jar" New topic
Author

display icon for core java executable jar

a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
Hi All

Can any one help me to find solution to display icon for an executable jar which i am going to distribute.
Here the issue is i am not using either swings or applets.
So, is it possible with core java executable jar ?

Appreciations in advance.



kishore
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3595
    
  14

I don't think so. The icon associated with your jar will be associated with all jars, and I doubt that's what you want.

If you want a custom icon, I think you will have to use a wrapper executable with your icon, which simply starts up your jar.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Or a simple shortcut (.lnk) file with its own icon set.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
Stephan and Rob many thanks for your replies.

Stephan, can you give steps how to make wrapper executable jar with icon. I mean where to place icon and how to call it, either in manifest file or how. I'm bit new to this.

Rob, I don't think I can use that if I want to distribute this jar together with that icon. If there is any possibility please let me know.



Thanks
kishore
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3595
    
  14

No, a wrapper executable is simply a small program in a native language, that has the icon built in, and has the only task of starting up the JVM with your program.

Rob's solution is more elegant. I don't know about other operating systems, but in Windows, you can create a new shortcut through the context menu (right mouse button) and have it link to your Jar. Then, right click the shortcut and go to properties, and you can embed an icon into it.

You will have to provide different shortcuts for different OSes.
a kishore
Ranch Hand

Joined: Sep 16, 2009
Posts: 82
Thank you Stephan. I managed to do it now.
 
Consider Paul's rocket mass heater.
 
subject: display icon for core java executable jar
 
Similar Threads
java.lang.ClassNotFoundException: COM.ibm.db2.jdbc.app.DB2Driver
null ImageIcon from getResource in jar
Image inside jar file
How to Create an Executable Jar..?
icon for executable jar file