Well, the truth is, there is no one step way to do this. This is what users tend to do:

  • Extract the Jar file
  • Delete the Jar file
  • Run the Jar command to re-create the Jar file.

So yeah, I can make a batch file for this but since I have no idea how to make one, I decided to use Ant.

Here is my script.

The following explains the steps that the build script executes:

  • Go over all folders recursively to look for existing jar files.
  • Extracts them one by one in a folder name that is the name of the Jar file + “_folder”.
  • Delete the old Jar file
  • Re-create the Jar file
  • Delete the folder

That’s it! Simply put the build script file in any folder you want it to start searching for Jar files and it does the rest.

To fix this Ant error message that confuses users into thinking that the cause of the error is somewhere in the foreach tag, do the following steps:

  1. Go to  the download page of ant-contrib at http://sourceforge.net/projects/ant-contrib/files/
  2. Download ant-contrib-0.3 and copy ant-contrib-0.3.jar to the lib folder where your Apache Ant is installed.
  3. In your build.xml file, make sure you declare this XML

That is all!

Related Posts Plugin for WordPress, Blogger...