File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes custom desktop icons and file extensions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "custom desktop icons and file extensions" Watch "custom desktop icons and file extensions" New topic

custom desktop icons and file extensions

Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

How would you go about creating a custom desktop icon for an executable jar file. Also how do you assign custom file extensions to files.

Jesus lives
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Well, when you run a Java Application you do it by means of running the java application launcher, which is that command line tool named java or javaw.

Now, you jar file is actually executed by this application and the default icon assigned to this application is the one that will be shown on the window when you run your application also.

Hence, as your application is actually executed by the java command you could create a batch file or a shell script to initiate your application, then create a shortcut to the batch file or shell script and assign an icon to it.

We all do this just to avoid to the final user the complexities of launching the application using the command line.

Most operating systems will let you do this very easily. Under Windows you simply right-click the shortcut icon and change its properties to show the icon of your preference. Under Linux, when you create the shortcut using Gnome Desktop Manager, for instance, you select the icon you want to use for it.

Now, there a few tools in the market which let you wrap your application within a small platform specific executable. These kind of tools let you assign an icon to your executable file.

Such is the case of Launch4J. If you are under Windows, give it a look. It might help with this.

Finally, I think I do not understand what you mean by this of the customized file extensions. What is it that you want to do?
[ June 06, 2006: Message edited by: Edwin Dalorzo ]
I agree. Here's the link:
subject: custom desktop icons and file extensions
It's not a secret anymore!