| 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: 19232
|
|
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
How To Ask Questions How To Answer Questions
|
 |
Leandro Coutinho
Ranch Hand
Joined: Mar 04, 2009
Posts: 415
|
|
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: 19232
|
|
|
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
|
 |
 |
|
|
subject: change the icon of .jar file
|
|
|