Click here to Skip to main content
11,716,249 members (88,970 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Java
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 30-Apr-13 14:16pm
ThePhantomUpvoter at 30-Apr-13 21:22pm
H.Brydon at 1-May-13 0:35am
Enter that as a solution and you'll get a +5 from me. :-)
Nenad Smiljkovic at 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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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!
Nenad Smiljkovic at 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...
Amitosh Swain at 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.
Nenad Smiljkovic at 4-May-13 18:04pm
I like this solution.
Can you provide some links to tutorials or recommend some books?
Thank you.
Amitosh Swain at 4-May-13 20:43pm
For learning JAVA??
Nenad Smiljkovic at 5-May-13 17:29pm
No! hahaha :)))
For wraping it up in an .exe.
Amitosh Swain at 6-May-13 7:44am
It's straight forward. It's got a nice GUI with a wizard interface. Download from the site, run the executable, select your exe, configure some options like JRE version, JVM start-up commands, splash screen etc. Click save, your executable will be created. It's very easy and the site has even got documentation for it.
Nenad Smiljkovic at 6-May-13 10:42am
Thank you!

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 599
1 Richard MacCutchan 280
2 Maciej Los 275
3 OriginalGriff 160
4 F-ES Sitecore 135
0 Sergey Alexandrovich Kryukov 1,003
1 Richard MacCutchan 430
2 CHill60 415
3 Maciej Los 399
4 OriginalGriff 385

Advertise | Privacy | Mobile
Web02 | 2.8.150901.1 | Last Updated 2 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100