Friday, July 5, 2013

Create a keystore (Certificate) and then sign jar (applet)

To sign a jar
  1. Need to create a keystore (like Certificate)
    1. Go to your java jdk directory (e.g. C:\Program Files\Java\jdk1.6.0_25\bin)
    2. Type keytool -genkey -keystore icepdfapplet.keystore -alias icepdfapplet -keyalg RSA where icepdfapplet.keystore will be created
    3. You will be asked for Name, Unit... and password (Please remember the password)
    4. The keystore will be successfully created
  2. Now assign the certificate to the jar
    1. Type jarsigner -keystore icepdfapplet.keystore -storepass 123456789 icepdf-applet.jar icepdfapplet where 123456789 is the password I entered in the previous and icepdf-applet.jar is the jar file being assigned with the certificate
>keytool -genkey -keystore icepdfapplet.keystore -alias icepdfapplet -keyalg RSA
>jarsigner -keystore icepdfapplet.keystore -storepass 123456789 icepdf-applet.jar
icepdfapple

Thursday, July 4, 2013

"ant" is not recognized as an internal or external command

If you find that you run ant command in command prompt, there is an error that "ant" is not recognized as an internal or external command,

Please do the following steps.
  1. Download the apache-ant binary distributions zip file and unzip it under C:\bin directory
  2. Edit the computer environment variable (Right click My Computer and select properties > Advance > Environment Variable)
  3. Add C:\bin\apache-ant\bin in Path Variable
When open a command console, and type echo PATH. You will see the newly added path C:\bin\apache-ant\bin