please anyone inform me step by step to build a signed jar form a jar.. ie signing a jar file which contains applet

Dani AI

Generated

A concise, practical checklist that builds on the tutorials referenced. This shows the usual build order, exact commands you can run, and the common pitfalls that cause runtime security errors.

Generate or create a keypair (in a keystore), request a CA cert if you need a trusted publisher, then sign the JAR and verify the result:

keytool -genkeypair -alias mykey -keyalg RSA -keysize 2048 -keystore mykeystore.jks -validity 3650

keytool -certreq -alias mykey -file myapp.csr -keystore mykeystore.jks   # send CSR to CA

# after CA returns the certificate chain:
keytool -importcert -alias mykey -file mycert_chain.cer -keystore mykeystore.jks

jarsigner -keystore mykeystore.jks myapplet.jar mykey
jarsigner -verify -verbose -certs myapplet.jar

Important manifest and build rules (do these before signing). Put required security attributes into META-INF/MANIFEST.MF and ensure the manifest is in the JAR before you sign it:

Manifest-Version: 1.0
Permissions: all-permissions
Codebase: *
Application-Name: MyApplet

Use the jar tool to include the manifest as the final packaging step, then run jarsigner. If you need SHA-256 signatures on older toolchains, add -sigalg SHA256withRSA -digestalg SHA-256 to jarsigner. To preserve the signature after the certificate expires, request a timestamp from your CA and add -tsa <tsa_url> when signing.

Troubleshooting tips: sign every dependent JAR with the same key (unsigned library JARs cause SecurityException), do not alter the JAR after signing, import the full CA chain into the keystore if verification fails, and check jarsigner -verify -verbose to inspect the chain. For production, use a CA-issued code-signing certificate — self-signed jars will show warnings and may be blocked. Note: modern browsers have largely removed support for the Java browser plugin, so applets may no longer run in typical user environments; consider migrating to a different delivery model if targeting current browsers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.