2

I want to sign a jar file that are containing another jar files and some class files. Actually I know how to sign a jar file and I did it but here I have an applet file in which I used HttpClient of apache but when I run it from browser it gives an error org.apache.commons.httpclient methods are not found. So what should I do? When I run this applet on applet viewer it runs but from browser it can't. Please help me.

Balasaheb
  • 625
  • 2
  • 12
  • 33
  • Sign jar files you are using in your project. And when your project is built sign the main jar file that contains signed jar files inside. –  Aug 17 '12 at 09:01

2 Answers2

3

If you need to execute only signed code you should not include JAR files into your applet - instead you should include only the class files from the Jar-to-be-included into your applet.

If you sign the code afterwards also the class files from the jar are getting signed and therefore should be usable from within your applet.

Robert
  • 39,162
  • 17
  • 99
  • 152
  • thanks for replay, suppose my class depends on other libraries like apache's HttpClient, HttpMethod; then should I include only that files with my main jar file and sign it? or hole apache jar file should be include for sign? – Balasaheb Aug 17 '12 at 10:29
  • If you want to minimize the final JAR file size you can use ProGuard tool in no-obfuscation and no-optimization mode. This will remove unused classes and methods but it requires a lot of tests and a bit configuration as minimized apps usually do not work directly out-of-the-box. – Robert Aug 17 '12 at 12:32
0

I think the following steps should help:

  • Sign all jar files you are using in your project

  • Make sure all library jar files are included to the final app jar file

    main jar manifest file should contain Class-Path key with relative path to jar files, included to the main jar file.

  • When main application is built sign the main app jar file