aspose file tools*
The moose likes Java in General and the fly likes change the icon of .jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "change the icon of .jar file" Watch "change the icon of .jar file" New topic
Author

change the icon of .jar file

akki maha
Greenhorn

Joined: Oct 09, 2010
Posts: 4
Hi,

I have created a executable test.jar. The icon of test.jar is platform dependent and apperas to be default icon.
I would like to add my own icon to test.jar.

How to achieve this?


-akash
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

Unlike an EXE file, a JAR file has no icon. It's the operating system* that gives it an icon. You cannot change the icon of one JAR file without changing the icon of all JAR files. You should consider using a shortcut, but that's not platform independent.


* Actually the window manager, but let's not go into details. It's not the JAR file itself.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 417
Hey akki. I don't think you can set this with some jar file attribute, but you can modify the icon depending the operating system.
In Ubuntu, right click -> properties -> in the basic tab, click on the picture, then select your icon.

This is not a nice solution, because you would need to do this in all clients.
Balaji Ashokkumar
Greenhorn

Joined: Oct 11, 2010
Posts: 5
you can change the icon of the jar file by the below code:

what i have done here is, I have saved the image 'mylogo.png' in a folder named 'images'. Then i am making it as the icon of the jar file.
To make the clients to see your icon, Made that image folder as hidden folder and send that hidden folder along with zip file in which you will place your jar application and lib files.


Balaji Ashokkumar, ~Dynamic Star~
With God,I'm a Hero... Without God,I'm a Zero...
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

How does the OS pick up that code (without running a JVM)?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

That will change the icon of the frame, and probably also how it is shown on the taskbar. It will not change the icon of the JAR file though.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

On a Mac you can make a bundled Application, so it look like a 'real' Mac OS X Application. Here you can see how this is done: http://www.centerkey.com/mac/java/

On Windows you need to do a bundle, e.g. like this one: http://www.ej-technologies.com/products/exe4j/overview.html - or use a .BAT/.CMD file as the start point.


Regards, Rene Larsen
Dropbox Invite
 
Don't get me started about those stupid light bulbs.
 
subject: change the icon of .jar file