Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creating Shortcut for JavaFX Webstart Application

2651296Apr 9 2014 — edited Apr 14 2014

I'm trying to deploy a JavaFX app using a jnlp file.  I'd like to create a shortcut and a start menu item for my application.

In my ant build.xml file I have:

                                <!-- Creates an installer -->

                                <fx:deploy width="500" height="600" embeddedWidth="100%" embeddedHeight="100%"

                                           outdir="${project.build.directory}/deploy" outfile="${project.build.finalName}"

                                           nativeBundles="all" verbose="true">

                                    <fx:info title="${project.name}" vendor="My Company"

                                             description="My GUI (Webstart)"/>

                                    <fx:application refId="myGui"/>

                                    <fx:permissions elevated="true"/>

                                    <fx:template file="${project.basedir}/src/main/webapp/index_template.html"

                                                 tofile="${project.build.directory}/deploy/MyApp.html"/>

                                    <fx:resources>

                                        <fx:fileset dir="${project.build.directory}/signed" includes="*.jar"/>

                                    </fx:resources>

                                    <fx:preferences install="true" menu="true" shortcut="true"/>

                                    <!-- set your jvm args-->

                                    <fx:platform javafx="${javafx.version}+">

                                        <fx:jvmarg value="-Xms512m"/>

                                        <fx:jvmarg value="-Xmx1024m"/>

                                    </fx:platform>

                                </fx:deploy>

Note the fx:preferences element setting install, menu and shortcut to true.

The generated JNLP looks like:

<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="MyGui-1.5.3-SNAPSHOT.jnlp">

  <information>

    <title>MyGUI</title>

    <vendor>My Company</vendor>

    <description>My GUI (Webstart)</description>

    <offline-allowed/>

  </information>

  <resources>

    <jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>

  </resources>

  <resources>

    <j2se version="1.6+" java-vm-args="-Xms512m -Xmx1024m "  href="http://java.sun.com/products/autodl/j2se"/>

    <jar href="MyGUI-App-1.5.3-SNAPSHOT.jar" size="49401741" download="eager" />

  </resources>

<security>

  <all-permissions/>

</security>

  <shortcut><desktop/></shortcut>

  <applet-desc  width="500" height="600" main-class="com.javafx.main.NoJavaFXFallback"  name="MyGUI-1.5.3-SNAPSHOT" >

    <param name="requiredFXVersion" value="2.2+"/>

  </applet-desc>

  <jfx:javafx-desc  width="500" height="600" main-class="com.mycompany.javafx.MyApp"  name="MyGUI-1.5.3-SNAPSHOT" >

    <fx:argument>-r</fx:argument>

    <fx:argument>/MyConfig.cfg</fx:argument>

    <fx:argument>-e</fx:argument>

    <fx:argument>dev</fx:argument>

  </jfx:javafx-desc>

  <update check="background"/>

</jnlp>

However, when I run the jnlp, the user is not prompted to install or create shortcuts or anything.  It just runs the GUI and they need to click on the JNLP file to run again.

I noticed that the <shortcut> element is not inside the <information> element as specified here:  http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#information

Is there an issue with JavaFX creating shortcuts through Webstart?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2014
Added on Apr 9 2014
2 comments
727 views