Search code examples
javajava-8jnlpdigital-certificatejar-signing

Run a jnlp file after migrating to Java 8


I am working on a project and the client is now moving from Java 6 to Java 8. We download a jnlp file in our project to run a java application. In Java 6, we had no issues but now after migrating to Java 8 we are facing security problems as we cannot use a self-signed jar anymore. The client has provided us a certificate. My question is to how to run that jnlp file in Java 8? I have tried signing the jar that we use in the jnlp file. I used the cacerts keystore provided by Java. I ran the following commands to add the certificate to the Java keystore:

keytool -import -keystore cacerts -alias myalias -file "mycertificate"

jarsigner -keystore cacerts myjar myalias

Now, I get the following error while doing this jarsigner: Certificate chain not found for: myalias

What should I do to make that jnlp run in the machine as I cannot even sign the jar that we use? The jnlp template is this:

<information>
    <title>${appTitle}</title>
    <vendor>Vendor</vendor>
    <homepage href="${codeBase}" />
    <description>Java App</description>
</information>

<security>
    <all-permissions/>
</security>

<resources>
    <j2se version="1.6+" />
    <jar href="${jarPath}" />
    <#if jarDependenciesPath??>
    <#list jarDependenciesPath as jarDependencyPath>
    <jar href="${jarDependencyPath}" />
    </#list>
    </#if>
 </resources>
 <application-desc
     name="${appTitle}"
     main-class="${mainClass}"
     width="300"
     height="300">
     <#list args as arg>
        <argument>${arg}</argument>
     </#list>
 </application-desc>


Solution

  • It seems your certificate is not good. Use good certificate.

    Alternatively, you can add exceptions in JAVA console to bypass the security.