Customize Java application icons

Oct 13, '01 03:12:52PM

Contributed by: robg

If you've ever tried to paste a custom icon on a Java application (such as LimeWire or jEdit), you'll find it's impossible, at least through normal means. I ran across this due to some sort of odd design in the LimeWire icon - when placed in my DragThing dock, the LimeWire icon did not respond to a mouse click (quite odd). So I went to paste a replacement in, only to find that it was impossible. I also tried creating an alias and pasting a custom icon there (no go) as well as using an AppleScript to open LimeWire (no go - AppleScript must have a syntax for opening Java apps that I just don't know; it can't find the LimeWire app).

After a bit of poking around in MRJAppBuilder, I found a fairly easy way to replace Java applications' icons. If you'd like the step-by-step method, read the rest of this article.

By the way, that new LimeWire icon is from a set called "Unreleased" by Pedro Fernandez, downloaded from xicons.com.

To replace the icon for a bundled Java application such as LimeWire or jEdit, you'll first need an actual Mac OS X .icns file. You can't use a pasted icon from a folder. Some downloaded icons will be in "folder" format, others (such as the replacement LimeWire icon mentioned earlier) are in .icns format already. If you'd like to convert a standard "folder" icon into a .icns file, you'll need something like Iconographer. Paste in the image and "Save As" in a .icns format.

Once you have your .icns file, here's how to use it:

  1. Right click on the Java application in the Finder and select "Show Package Contents".

  2. Select the "Contents" folder, and then open Info.plist file in your favorite text editor. Just below the "dict" tag, you should see:
    <key>CFBundleIconFile</key>
    <string>GenericJavaApp.icns</string>
    Replace "GenericJavaApp.icns" with the name of your new icon file - make sure the case matches and you include the .icns extension. Save your changes.

  3. Drag your new .icns file into the "Resources" folder that's in the "Contents" folder you opened in step one.
That's it! To make the icon show up immediately, you can try a couple of things -- launch the application, logout/login, or move the app to a new location and then move it back. It may not seem like it worked, but I had success on all three Java apps I tried; it just some action on the file to make the new icon show in the Finder.

The process isn't quite as intuitive as pasting in the Get Info window, but it's not that much harder -- and the customized icons look so much nicer than the generic Java coffee mug!

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20011013151252942