3 Replies Latest reply: Dec 15, 2011 5:58 AM by 905433 RSS

    Signed Jars

    905433
      I have a web based project that includes numerous iamges. As a result of the images I must sign the jar files. However, to date I have been unsuccessful. I have reviewed the threads and deployment information and would appreciate a straightforward way to accomplish this with Net Beans (the signing function there has not worked for me as well). I would appreciate any assistance.
        • 1. Re: Signed Jars
          817264
          Could you please be more specific?
          I have a web based project that includes numerous iamges. As a result of the images I must sign the jar files.
          Why?
          I am not sure i follow why images require signing jars.

          Please post trace file for unsigned app to see what is the root cause.
          (see details on how to enable here - http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html#gcexdf)
          However, to date I have been unsuccessful. I have reviewed the threads and deployment information and would appreciate a straightforward way to accomplish this with Net Beans (the signing function there has not worked for me as well). I would appreciate any assistance.
          What version of NB do you have? 7.1RC? Did you initially create your project using older version of NB?
          What version of JRE and JavaFX Runtime do you have? Do you test you app using file:// protocol (and not http)?

          pre 7.1 versions of NB were enabling new signing method by default and result was hitting bug in JavaFX Runtime if file protocol is used.
          And after migrating to 7.1 you actually need to recreate your project to update of files in the nbproject folder
          I.e. install 7.1, create new project and copy sources over. Then enable signing (check "Request unrestricted access in the Project Properties->Deployment).

          If it still does not work then provide:
          * content of generated JNLP file
          * List of files in the META-INF folder in the application jar
          * detailed trace file
          • 2. Re: Signed Jars
            jsmith
            If you can place the images inside your jar file and load them from there or place them on a server that hosts crossdomain.xml (*exactly* this file http://static.flickr.com/crossdomain.xml) in the root directory of it's domain, then you do not need to sign your jar file. If you cannot do either of these things and the images must be hosted on a different server than the one hosting your jars, then read on.

            Do not try to use the javafxpackager command line tool to sign jars as that does not currently work => this issue can be tracked here: http://javafx-jira.kenai.com/browse/RT-18246

            Signing documentation is here =>
            http://docs.oracle.com/javafx/2.0/deployment/packaging.htm#BABJGFBH
            http://docs.oracle.com/javafx/2.0/deployment/javafx_ant_task_reference001.htm#CIAFJGAB
            But you have already read all that.

            Signing requires the following steps.
            1. Generate a Certificate Signing Request (CSR).
            2. Submit the CSR to a Certificate Authority (CA).
            3. The CA will generate a code signing certificate for you.
            4. Package your application as a bunch of jar files.
            5. Sign the jar files using your code signing certificate.
            If you are just using a self signed certificate and you are already using NetBeans, then NetBeans can do all of this for you.

            Here are the steps I used to sign a JavaFX project consisting of multiple Jar files using NetBeans nightly build 201112120600
            1. Right click Project and choose Properties.
            2. Project Properties | Libraries | Compile |Add Library... and add your dependent jars.
            3. Project Properties | Packaging
            Check Compress JAR File
            Check Build JAR after Compiling
            Check Copy Dependent Libraries
            Do not check Binary Encode JavaFX CSS Files as that might be buggy.
            4. Project Properties | Deployment
            Check Request unrestricted access
            Signing Certificate: Edit...
            a) choose Self-signed by a generated key OR
            b) use your own keystore if you have a certificate from a trusted public CA.
            Download Mode for Libraries: Use the mix of eager and lazy appropriate for your app. Signing wise, it doesn't matter as all of the jars need to be signed anyway.
            5. Project Properties | Run
            Configuration | New... | Configuration Name => enter browser
            Application Class | Browse... choose your Application's main class.
            Check Use Preloader if you have one (the preloader jar will be signed). If you are having difficulties with basic signing, get that to work first before enabling the Preloader.
            Select Run | in Browser
            Set a Width and Height for the page.
            Leave Web Page empty until you get an empty web page with your app in it to work.
            Choose the Web Browser you want to launch the app in.
            Press OK.
            6. Select the browser config from the drop down combo and hit the run arrow.
            Netbeans will compile your app, package it, generate a self signed certificate, sign all of your application's jars and launch the application in a browser.

            A trick to getting all of the above to work more than one time, is to make sure that you close the browser tab after you have finished testing and before you try to run again, otherwise NetBeans seems to fail with weird errors because the distribution files get locked by the app running inside the browser under Windows.

            If you are still stuck, you can try opening this JavaFX project which uses self-signed jars in NetBeans 7.1 RC2 or later => http://willow-browser.googlecode.com/files/willow-src-prerelease-0.1-netbeans-project.zip
            • 3. Re: Signed Jars
              905433
              Thanks so much for the quick responses.....I will try your suggestions and report back.....Thanks so much