How do I extract the contents of a jar file?
Author: Deron Eriksson
Description: This tutorial describes how to extract the contents of a jar file using an Eclipse External Tool Configuration.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)

In EclipseSW, it is possible to run a jarW command to extract the contents of a jar file by creating an External Tool Configuration for that command. An example of this is shown here.

Name:extract jar contents
Working Directory:${container_loc}
Arguments:-xf "${resource_loc}"

The working directory is set to the container of the resource (ie, the folder of the jar file) that is selected. The "xf" argument specifies that we want to extract the specified jar file. The selected jar file is specified using the resource_loc variable. The double-quotes around the resource_loc are used to handle the case where a folder in the path to the jar file may have a space in its name. This external tool configuration is shown below.

'extract jar contents' External Tool Configuration

As an example, I selected the "maven-2.0.8-uber.jar" file and selected the "extract jar contents" External Tool Configuration.

Executing 'extract jar contents' on 'maven-2.0.8-uber.jar'

After the command has finished, we can see that the contents of the jar file have been extracted to the same folder containing the jar file.

Extraction results