Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a desktop icon using JWS JNLP for a JavaFX app

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/"/>
    <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.

like image 786
mikewilliamson Avatar asked Jan 17 '10 09:01

mikewilliamson


2 Answers

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.

like image 93
Eric Wendelin Avatar answered Sep 30 '22 12:09

Eric Wendelin


I suppose the problem in your case is the missing CODEBASE attribute. See one working snippet:

<?xml version="1.0"?>
<jnlp spec="1.5+" 
      codebase="http://www.sweethome3d.com/" 
      href="SweetHome3D.jnlp">
  <information>
    <title>Sweet Home 3D</title>
    <vendor>eTeks</vendor>
    <homepage href="http://www.sweethome3d.com/"/>
    <description>Sweet Home 3D</description>
    <description kind="short">Arrange the furniture of your house</description>
    <icon href="SweetHome3DIcon.gif"/>
    <icon kind="splash" href="SweetHome3DSplashScreen.jpg"/>
    <offline-allowed/>
    <shortcut online="false">
      <desktop/>
      <menu submenu="eTeks Sweet Home 3D"/>
    </shortcut>
    <association extensions="sh3d sh3l sh3f sh3t sh3p" 
                 mime-type="application/SweetHome3D"/>
  </information>
like image 44
WindRider Avatar answered Sep 30 '22 12:09

WindRider