title: How can I sign and deploy a JavaFX application into a single .JAR?
body: <p>I'm still learning the ins and outs of JavaFX. One major difference is that in the dist folder (in addition to the library) I find besides the .jar file, an HTML file and a JNLP file, neither nor of which is any use to me (this will be a desktop application).</p>
  
  <p>I found the following (Properties omitted because of sensitive/irrelevant information):</p>
  
  <p></p>
  
  <pre><code>&lt;delete dir="${store.dir}"/&gt;
  &lt;mkdir dir="${store.dir}"/&gt;
  
  &lt;jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip"&gt;
      &lt;zipgroupfileset dir="dist" includes="*.jar"/&gt;
      &lt;zipgroupfileset dir="dist/lib" includes="*.jar"/&gt;
  
      &lt;manifest&gt;
          &lt;attribute name="Main-Class" value="${main.class}"/&gt;
      &lt;/manifest&gt;
  &lt;/jar&gt;
  
  &lt;zip destfile="${store.jar}"&gt;
      &lt;zipfileset src="${store.dir}/temp_final.jar"
      excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/&gt;
  &lt;/zip&gt;
      &lt;delete file="${store.dir}/temp_final.jar"/&gt;
  
      &lt;delete     dir = "${build.output.dir}"/&gt;
      &lt;mkdir      dir = "${build.output.dir}"/&gt;
  
      &lt;signjar
                  jar = "${store.jar}"
            signedjar = "${build.output.dir}/${FileName}"
                alias = "${comodo.key.alias}"
            storepass = "${comodo.key.storepass}"
             keystore = "${comodo.key.store}"
            storetype = "PKCS12"
              keypass = "${comodo.key.pass}"
               tsaurl = "${timestamp.url}"/&gt; 
  </code></pre>
  
  <p>This was intended to build both the "executable" MAIN JAR and all dependent libraries into a single .JAR that could be run from any location, and then take and sign that JAR and move it into a "signed" directory.</p>
  
  <p>This works fine for any JAR library or Swing GUI application JAR, but when I tried the same thing with a JavaFX application it borked:</p>
  
  <pre><code>Error: Could not find or load main class com.javafx.main.Main
  </code></pre>
  
  <p>I'm not entirely surprised to find it NOT work, but it is a bit of a problem. I did some research on possibly deploying a "self-contained" application but that will not suit our needs. My employer procured at some expense a Comodo certificate, and I quickly ran into a wall in which it appears that because of Apple shenanigans (unless I am mistaken in this presumption) you have to join their developer club for the low low cost of $100 a year (not happening). I don't really do development for the apple platform SPECIFICALLY. I do Java development. Anyway, if I am correct that will not work for us so a self-contained deployment for Windows, Linux and Mac is out (again, if I am correct).</p>
  
  <p>I'm hoping that this is something simple.</p>
  
  <p>So how do I apply the ANT script I created for compiling a JAR containing all dependent LIBs into a code-signed JAR to a JavaFX application?</p>
  
  <p>EDIT 1: Okay so definitely spoke too soon. Not very close to an answer. I've tried to frankenstein what I know about compiling and signing regular JAR files so that all libs are included and that the sign is successful into what I've been able to pick out of the <a href="http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference.htm#CIADDAEE" rel="nofollow">manual</a>. What I have is a hodgepodge and a failure. I get a .JAR file with everything in it except for the main .JAR file. Anyway this is the ANT script code:</p>
  
  <p>Properties:</p>
  
  <pre><code>&lt;property  name = "name"
            value = "APPNAME"/&gt;
  
  &lt;property  name = "file"
            value = "APPJAR"/&gt;
  
  &lt;property  name = "MC" 
            value = "MAINPACKAGE.MAINCLASS" /&gt;
  
  &lt;property  name = "released.dir"
            value = "released"/&gt;
  
  &lt;property  name = "compiled.dir"
            value = "${released.dir}/compiled"/&gt;
  
  &lt;property  name = "stored.dir"
            value = "${released.dir}/stored"/&gt;
  
  &lt;property  name = "signed.dir"
            value = "${released.dir}/signed"/&gt;
  </code></pre>
  
  <p>Everything else:</p>
  
  <pre><code>&lt;delete dir = "${released.dir}"/&gt;
          &lt;mkdir dir = "${compiled.dir}"/&gt;
  
          &lt;fx:jar destfile = "dist/compiled.jar"&gt;
              &lt;fx:platform javafx = "8.0+" j2se = "8.0"/&gt;
              &lt;fx:application      name = "${name}"
                              mainClass = "${MC}"/&gt;
  
              &lt;fileset dir = "build/classes"/&gt;
  
              &lt;fx:resources&gt;
                  &lt;fx:fileset dir = "dist" includes = "lib/*.jar"/&gt;
              &lt;/fx:resources&gt;
          &lt;/fx:jar&gt;
  
          &lt;fx:signjar keystore = "${comodo.key.store}"
                         alias = "${comodo.key.alias}"
                     storetype = "PKCS12"
                       keypass = "${comodo.key.pass}"
                     storepass = "${comodo.key.storepass}"
                           jar = "dist/compiled.jar"
                       destdir = "${compiled.dir}"/&gt;
  
          &lt;mkdir dir = "${stored.dir}"/&gt;
  
          &lt;jar       destFile = "${stored.dir}/temp_final.jar"
              filesetmanifest = "skip" &gt;
              &lt;zipgroupfileset      dir = "${compiled.dir}"
                               includes = "compiled.jar"/&gt;
  
              &lt;zipgroupfileset      dir = "dist/lib"
                               includes = "*.jar"/&gt;
  
              &lt;manifest&gt;
                  &lt;attribute name = "Main-Class"
                            value = "${main.class}"/&gt;
              &lt;/manifest&gt;
          &lt;/jar&gt;
  
          &lt;zip destfile = "${stored.dir}/${file}"&gt;
              &lt;zipfileset src = "${stored.dir}/temp_final.jar"
                     excludes = "META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/&gt;
          &lt;/zip&gt;
  
          &lt;delete file="${stored.dir}/temp_final.jar"/&gt;
  
          &lt;mkdir dir = "${signed.dir}"/&gt;
  
          &lt;signjar
              keystore = "${comodo.key.store}"
                 alias = "${comodo.key.alias}"
             storetype = "PKCS12"
                tsaurl = "${timestamp.url}"
               keypass = "${comodo.key.pass}"
             storepass = "${comodo.key.storepass}"
                   jar = "${stored.dir}/${file}"
               destdir = "${signed.dir}"/&gt;
  </code></pre>
  
  <p>And that's what I have to show for my time. If anyone can glean something from this that may put me on the right track (if I am even close, which I don't feel like I am), that would be super awesome.</p>