Make a Jar Archive File on Mac

Mindwatering Incorporated

Author: Tripp W Black

Created: 06/21/2011 at 10:35 PM

 

Category:
Notes Developer Tips
Java

Issue:
How to take some class files and archive them together into a jar so they are available to a Java Agent.

Solution:
1. Get all the files into a proper directory structure:
e.g. For: com.apple.cocoa.application = Users/tripp/Documents/classfiles/com/apple/cocoa/application.

2. Open terminal window and navigate to the folder above the com folder (e.g. classfiles using example above).

3. Enter the following command:
jar cfM cocoa-application.jar com/*

Note: this will create a jar file named cocoa-application.jar in the same folder above com (e.g. classfiles).

4. Import into your Java Agent via the import archive button of the Java Agent "splash" screen.



previous page