The JAR Contents Property Editor

The JAR Contents property editor enables you to specify which files you would like included in your JAR file. You can open it by right-clicking the node of your JAR recipe file, choosing Properties, selecting the Contents property, and clicking the ellipsis (...) button.

You can select directories and files in the Source panel and 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 button to make this directory the window root and explore from there. 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 destination based on the new package root. For example, you could have the following hierarchy, displayed in the Source Pane:

MyFilesystem
    mypackage
        A.class
        mysubpackage
            B.class
            C.class
MyOtherFilesystem
If you select mypackage and push the button, the MyFilesystem and MyOtherFilesystem nodes will disappear and Mypackage will become the top node in the tree. If you add B.class, its destination will be mysubpackage, since the tree is rooted at mypackage. If you add A.class, its destination will be <root>, meaning that it will appear at the root of the JAR file.

Pushing the button the 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 by selecting the entry you want to remove and clicking 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 will be 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 Destination 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 destination for that particular entry. This field is empty for entries you have added without a relative root or a prefix (though the entries will maintain their default directory (package) structure in the resulting JAR file).

The Destination 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