The JAR Contents Property Editor

The JAR Contents property editor enables you to specify which files you would like included in your JAR file.

To open the JAR Contents property editor:

  1. In the Explorer, right-click the node of your JAR recipe file and choose Properties.
  2. Select the Contents property and click the ellipsis (...) button.

Select directories and files in the Source panel. Then click Add to have them added to the JAR file. When you add a directory to a JAR, you also add all of its contents.

Source panel

The Source panel displays a tree view of all filesystems mounted and visible in the Explorer. You can navigate this tree and select directories you would like to add to your JAR file. When you select a directory to add, click the Add button in the middle of the property editor.

The top of the Source panel contains two buttons. When you have a directory node selected, you can click the Explore from the selected folder button to make this directory appear as the root directory in the window. The directories one level below this new window root then are considered the new package roots. If you then select a file or directory and click Add, it is added to the JAR with its target based on the new package root. For example, you could have the following hierarchy, displayed in the Source panel:

MyFilesystem
    mypackage
        A.class
        mysubpackage
            B.class
            C.class
MyOtherFilesystem
If you select mypackage and click the Explore from the selected folder button, the MyFilesystem and MyOtherFilesystem nodes disappear. Mypackage becomes the top node in the tree. If you add B.class, its target becomes mysubpackage, since the tree is rooted at mypackage. If you add A.class, its target is <root>. This means that A.class appears at the root of the JAR file.

Clicking the Explore from the parent of the current root folder button in the Source panel moves the root up one level.

Chosen Content panel

Files and directories appear in the Chosen Content panel after you have selected them in the Source panel and clicked Add. You can remove entries from Chosen Content by clicking Remove All. Or you can select the entry you want to remove and click Remove.

In the Directory Prefix field, you can deepen the path of the files that you are about to add to the Chosen Content panel. For example, if a file's path is MyPackage/MyClass.class by default and you type org/acme/ in the Directory Prefix field, the directory structure in the JAR file becomes org/acme/MyPackage/MyClass.class.

Set the prefix before you add entries to the Chosen Content panel. The prefix does not apply to entries that you have already added.

The Target Directory field shows in which directory the chosen content will appear in the JAR file. You can edit this field if you want to change the target for that particular entry. This field is empty for entries you have added without a relative root or a prefix. However, the entries maintain their default package structure in the resulting JAR file.

The Target Name field applies only to items that are individual files. You can specify that the item is included in the JAR with a different file name. If you leave this field blank, the source file's name is used.

See also
Modifying a JAR File
Updating a JAR File
Setting a JAR Content Filter
Creating a JAR Manifest
Setting JAR Packager Options
Running a JAR File

Filesystems and the Java Classpath
Mounting a Filesystem

Legal Notices