How to change jar files default Icon?

Posted on 2006-05-10
Medium Priority
Last Modified: 2008-01-09
I have completed my Swings Application & now I have built a jar file of my complete application. Now this jar file has its default icon which I want to change & I want to use my own icon. & also that icon should be displayed on all platforms.
eg:- Now I am changing icon file on my Windows machine. Now when I will move that file on Mac or Linux, it should display same icon (my custom icon). How should I do that?

Please tell me.
Thanx in advance.
Question by:Econify
LVL 92

Accepted Solution

objects earned 500 total points
ID: 16647755
I believe thats (icon to display) is handled by the OS so don't think you can.
LVL 86

Assisted Solution

CEHJ earned 500 total points
ID: 16647935
You can choose whatever icon you want, you just can't automate it without native code, nor do it cross-platform
LVL 24

Assisted Solution

sciuriware earned 500 total points
ID: 16648459
You can change the icon for a specified file type using the Folder Options, File Types tab. using the "Change" option.

To do this using the registry, see this MSDN documentation.



Assigning a custom icon to a file class is a simple matter. Create a subkey, under the key for the application's ProgID, and name it DefaultIcon . Assign it a REG_SZ value containing the fully qualified path for the file with the icon. Any file containing an icon is acceptable, including .ico, .exe, and .dll files. If there is more than one icon in the file, the path should be followed by a comma, and then the index of the icon.


Copyright © 2005 Microsoft Corporation. All rights reserved.

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 15

Assisted Solution

Javatm earned 500 total points
ID: 16648952
I've done this a few times and the simplest way is right click the file and create shortcut now replace
the shortcut with the icon that you want to bundle with the application simple as that but if you want to change the whole jar file I dont think thats possible you can try sciuriware suggestion.

Expert Comment

ID: 16651154
As objects and CEHJ said, there is no way you can change the icon of a jar file.  That is handled by the OS or your desktop manager.  However, I imagine you can build a small installation program so that, for different platforms, the installation program will build different shortcuts that launches the jar file.  I am not aware of any other approach.
LVL 24

Expert Comment

ID: 16651587
Creating shortcuts on the Desktop to launch the application is yet a totally different topic.

The questioner asks how to display a certain custom icon in (all) file managers and explorers.
That is done by the Registry.
A C-program or a JNI program can do this; you can do it by hand via the folder options in the Windows Explorer etc.
As this is a one-time operation and can be done by operating an official Microsoft tool,
there should be a README file for the installer to set the icon.

Automation is nice but a complete program would here be a A-bomb to kill a fly.

LVL 15

Expert Comment

ID: 16652149
A follow-up on my comment if you want to automate this I think installAnywhere can do this in a much better manner together with an installer, it think its a free trial for 30 days.
LVL 24

Expert Comment

ID: 16885958

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question