views:

614

answers:

3

I am trying to get a custom destop icon to be displayed for my app but for some reason no matter what I do the same default java icon shows up. I have tried everything I can think of and gone and compared my jnlp file with others whose icons seem to work ok. According to everything I have read the following should work fine. But of course, it doesn't:

<information>
    <title>MikesApp</title>
    <vendor>Mike</vendor>
    <homepage href="http://www.mikesapp.com/"/&gt;
    <description>Mikes App.</description>
    <icon kind="shortcut" href="res/icon64x64.png" width="64" height="64"/>
    <offline-allowed/>
    <shortcut>
        <desktop/>
    </shortcut>
</information>

Any ideas would be greatly appreciated.

A: 

I don't have a specific answer I'm afraid, but Project MaiTai is an open source application written in JavaFX, and that has a custom desktop icon.

If you haven't done so already, maybe checking the JNLP code for MaiTai would give you some pointers.

Matthew Hegarty
A: 

There's an example of how to do this in the JavaFX in Action book, if you have access to that. You need to make sure the res/icon64x64.png file is actually downloadable from whatever site the app is hosted on, relative to the JNLP's location. Try loading it directly in a browser to ensure its available/valid.

Simon Morris
A: 

I would try the following, in order:

  1. Create an icon of 32x32 in size and add it as an additional <icon kind="shortcut".... The spec says that size is used for desktop icons.
  2. Use your 64x64 icon as the "default". For example, your new <icon> elements would be:

    <icon href="res/icon64x64.png" width="64" height="64"/>
    <icon kind="shortcut" href="res/icon32x32.png" width="32" height="32"/>
    <icon kind="shortcut" href="res/icon64x64.png" width="64" height="64"/>
    
  3. Remember that your images are accessed relative to your codebase attribute in your jnlp xml element

  4. If none of those work, you are welcome to compare your JNLP to one of mine that works.

I realize that this JNLP stuff is kind of a pain. Hope one of these work for you.

Eric Wendelin
Thanks Eric. I tried what you suggested but no joy so far.I created the shortcut icon, tried gif, png and jpg formats and used both absolute and relative uris. The one you have looks the same as what I have. The worst part is knowing that the solution is inevitably going to be something really stupidly simple.The JNLP stuff is a little painful to get your head around but I have ended up thinking its pretty cool. My icon frustrations are casting a bit of a shadow on my JNLP excitement for the moment. I am going to have another go at it this weekend and see if I can figure it out.
Mike Williamson
One other thing that I did that might make a difference is create a 256x256 png for the default that the system can rescale. If you post your whole JNLP I can take a look if you like.
Eric Wendelin
Maybe the (default) icon has been cached, so you might need to flush the cash before you'll see your new custom icon? (I have no clue how icons are handled by javaws, but it reminds me of favicon/browser-cache frustrations...). To clear the cache: Launch javaws ("Java Application Cache Viewer"), open the "Java Control Panel" via Edit | Preferences, press "Delete Files..." (on the "General" tab).
netzwerg
Yes, you can also do "javaws -uninstall myfile.jnlp" to clear any cached bits.
Eric Wendelin