Two Laptop Bag
The moose likes General Computing and the fly likes Custom file type extention and icon Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Custom file type extention and icon" Watch "Custom file type extention and icon" New topic

Custom file type extention and icon

Stephen Longville

Joined: Mar 25, 2010
Posts: 15
Hi, i've made a nice little program that has its own file extention in regards to saving and loading files (just converted ints to bytes etc...)

What i would like to do is have that file-type display a custom icon. I heard somewhere that to deploy this to other computers (including my own) i would need to create and check regestry information for this icon.

This is new teritory for me, making applications (guis and what not) is one thing but i havent even toutched regestry editing before.

Is it even possable? and could someone give me alot of help with it please?

Take care,
Stephen Longville

Joined: Mar 25, 2010
Posts: 15
by the way, would this help?:

and if so, where / what is the correct package to download?

Stephen Longville

Joined: Mar 25, 2010
Posts: 15
ok i've downloaded this:

i just dont know where to put it. i feel im getting onto the right track here but with my eyes closed
Peter Johnson

Joined: May 14, 2008
Posts: 5852

You can configure a custom icon by adding a DefaultIcon entry to the proper entry under HKEY_CLASSES_ROOT. The best way to do this is to follow an existing example. As an example, running redgedit I can see that the .zip extension is mapped to WinZip:

and that WinZip uses icon #2 packaged within winzip32.exe:

This redirection from .zip to WinZip allows many extensions (.tar, .gz, etc.) to use the same base configuration information. You could also place the DefaultIcon entry directory below the extension (that is, under .zip in this example). Also, it is not necessary to bury the icon in an EXE file, you could reference your .ico file directly.

Once you have it set up on your PC, extracting the registry entry as a .reg file and "executing" it as part of your install should work.

Of course, this is the manual way to do things. Most Windows installers provide functionality to automate this.

JBoss In Action
I agree. Here's the link:
subject: Custom file type extention and icon
It's not a secret anymore!