Tag Archives: java sign jar

How to sign Jars. Signing Jars for use in Applets.

As the Browsers now want the Jars to be signed it happens oft that man have to sign a Jar himself.

Here is a Manual how to sign a Jar.

First you have to install Java SDK.


Install the JDK from the list for the envitonment you use.

This Manual is made for Windows users. Set the JAVA_HOME variable and put the JAVA/bin folder in path in order to use the Java commands.

Now you can create your keystore and key pair. Navigate to your home folder as C:\Users\username and execute the following command there in console.

  • Generate a Java keystore and key pair
    keytool -genkey -alias mydomain -keyalg RSA -keystore .keystore

    You should answer some questions and in the end you end up with genrated keystore named .keystore and the key pair. You should write down the password for the keystore as it is important and will be used after that.

    Now navigate to the folder with your Jars and execute the folling commands in console:

    jarsigner -sigfile SIG -signedjar SignedApp.jar jar-to-sign.jar alias
    jarsigner -verify SignedApp.jar

    As in the place of alias put your alias you entered by Generation of the keystore. Jar-to-sign is the jarname you need to sign.
    The verify is made to verify is the jar really succesfully signed.

    Thats it.

    Happy signing.