Jar: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
=Create a JAR from Files Located in a Directory Different from the Current One=
=Create a JAR from Files Located in a Directory Different from the Current One=


Use <tt>-C</tt> ''before'' <tt>cfv</tt>:
Use <tt>-C</tt> ''after'' the JAR name and use <tt>.</tt> instead of <tt>*</tt> if you want to include ''all'' from <tt><directory-we-want-to-JAR-from></tt>:


<pre>
<pre>
jar -C <directory-we-want-to-JAR-from> cfv <JAR-file-name> *
jar -C <directory-we-want-to-JAR-from> cfv <JAR-file-name> .
</pre>
 
Example:
 
<pre>
jar cfv ./target/A.ear -C ./target/ear-A-content .
</pre>
</pre>

Revision as of 02:12, 25 March 2016

Internal

Create a JAR from Files Located in a Directory Different from the Current One

Use -C after the JAR name and use . instead of * if you want to include all from <directory-we-want-to-JAR-from>:

jar -C <directory-we-want-to-JAR-from> cfv <JAR-file-name> .

Example:

jar cfv ./target/A.ear -C ./target/ear-A-content .