Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

change the icon of .jar file

 
akki maha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the OS pick up that code (without running a JVM)?
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic