Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:45:50+00:00 2026-05-16T07:45:50+00:00

My JAR files must be signed for a webstart application. It would be nice

  • 0

My JAR files must be signed for a webstart application. It would be nice to also have them packed to minimize the download time. I’m trying to configure an Ant task to automatically do it during the deploy of the application. Since the pack process reorganizes the jar internal structure invalidating the signature, the Pack200 documentation recommends a 3 steps process:

  1. Repack the JAR with pack200
  2. Sign the JAR with jarsigner
  3. Compress JAR jar with pack200 generating an .jar.pack.gz file

Ant has a default signjar task, and Sun published a Pack200 ant task.

The problem is that Sun pack200 task just operate on one file at a time and the repack operation must specify an output file.

I believe it should be a fairly common operation, but my ant file is becoming overly complex and there’s too many temporary files. Time to beg for the wisdom of the community:

Is there an easy or, at least, standard way to pack and sign all my JAR files?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:45:51+00:00Added an answer on May 16, 2026 at 7:45 am

    Here is my own solution. I’ve discarded the prebuild ant targets, and decided to run directly the pack200 executable.

    This approach has some advantages:

    • it works (jarsigner was failing to verify some jars)
    • no dependencies besides the jdk
    • it doesn’t spend a lot of time repacking already repacked jars
    • it can sign and repack the files inline, allowing me to put the signed version under version control. No need to sign twice.

    Here is the code of the macro that repack and signs inline:

    <macrodef name="repack-and-sign">
        <attribute name ="rootdir"/>
        <sequential>
                <echo message="Repacking libs in @{rootdir}"/>
            <apply executable="pack200" parallel="false">
                <arg value="--repack"/> 
                <arg value="--segment-limit=-1"/> 
                <fileset dir="@{rootdir}" includes="**/*.jar" />
            </apply>
    
            <echo message="Signing libs in @{rootdir}"/>
            <signjar 
                alias="${keystore.alias}" keystore="${keystore.file}" storepass="${keystore.password}"
                lazy="true">
                <path>
                    <fileset dir="@{rootdir}" includes="**/*.jar" />
                </path>
            </signjar>
         </sequential>
    </macrodef>
    

    And here is how to pack:

        <apply executable="pack200" parallel="false" dest="${dir.tomcat.jar}">
            <arg value="--modification-time=latest"/>
            <arg value="--deflate-hint=true"/>
            <arg value="--segment-limit=-1"/>
            <targetfile/>
            <srcfile/>
            <fileset dir="${dir.tomcat.jar}" includes="**/*.jar" />
        <mapper type="glob" from="*" to="*.pack.gz" />
        </apply>
    

    Edited to provide a little more info for people that don’t know ant so well:

    The task above goes before your tags. Inside your tag first put a call to the macro like this so that it first repacks and signs each file:

        <repack-and-sign rootdir="${dir.tomcat.jar}" />
    

    Then follow that with the tag from above. This will do the final packing for each file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a URL list of jar files, also I have whole path classname
An existing application has a ton of JAR files in its classpath. Someone must
I downloaded all jar files for Spring Security 3.0 and added them to my
I have few jar files which I am not getting from any repositories.I have
I am tried deploying .cod,.alx.jar files on blackberry simulator 8100;the application is not getting
i want maven to download custom jar files from an ftp how to set
I have two signed Jars, a.jar and b.jar. a.jar is launched as an applet
I have a Java application (non-web) which must read from a properties file. This
I'm writing a program which must download documents from google docs. I have downloaded
I have an application called Update.jar that I'm trying to use with the java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.