Click here to Skip to main content
15,867,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody!

I would like to first start by saying thanks to everyone who takes some time to view this thread and try to help.

I am building GUI in JAVA.
I wanted to change JAVA's default icon ( coffee cup ) into my own icon.

The problem i have is following:

I have managed to change icon successfully for main form, but when I go to dist folder, I have a .jar file that has icon of its own.
My client wants its own icon to be seen everywhere, they are not interested in one JAVA offers.

So my question is:

How can I change icon on .jar file from default into one of my own choice?

---------------------------------------------------

I use Netbeans IDE and have JAVA SE 7.

If any other information is required ( source code or something similar ), please ask for it, I will more than gladly supply it.

----------------------------------------------------

Again,thank you all!
Posted
Comments
[no name] 30-Apr-13 21:22pm    
http://stackoverflow.com/questions/209812/how-do-i-change-the-default-application-icon-in-java
H.Brydon 1-May-13 0:35am    
Enter that as a solution and you'll get a +5 from me. :-)
MyOldAccount 2-May-13 12:22pm    
Actually,I have stumbled upon this solution myself! :))) Sadly,it does not change the icon of a .jar file. :((( Thank you for reply,anyway. :)

1 solution

Sorry to say but, you cannot change the icon displayed on the jar file directly. That's the icon displayed by your file browser/operating system for the file type.

You cannot do that unless:
1. You change the icon in the registry (for windows) or icon theme(for POSIX). But this will change the icon for all jars.
2. Use a shell hook. But it is Windows only and requires messy C++ coding.

These are not good practices. They just mess up things.


If your client wants to see the icon everywhere, then you can try these:
1. Add a shortcut to the desktop/app launcher with your icon.

2. If your deployment platform is windows
wrap your app in a launcher exe with your icon (ico file). Launch4j is a good option.

If platform is Linux, then add a .desktop file refering the icon and the icon (png file) to /usr/share/icons/hicolor/SIZE/apps/ where size must be 16,24,32,64 and 256

If mac,
Sorry, I don't know how to assign an app icon on that platform, a bit googling will do.

Good luck!
 
Share this answer
 
v2
Comments
MyOldAccount 2-May-13 12:18pm    
Unfortunately,I must agree with you.
Everything you said is true,but I still hoped to find some way to
do it.
Thank you,and everybody else who tried...
AlphaDeltaTheta 3-May-13 3:21am    
Depending upon the deployment platform, you can "wrap" it into an executable. That's a good idea and is used with programs like Netbeans, Eclipse and many others.
MyOldAccount 4-May-13 18:04pm    
I like this solution.
Can you provide some links to tutorials or recommend some books?
Thank you.
AlphaDeltaTheta 4-May-13 20:43pm    
For learning JAVA??
MyOldAccount 5-May-13 17:29pm    
No! hahaha :)))
For wraping it up in an .exe.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900