building jar with multidirectory projects

M

maurizio

What's the jar command to make a jar like those made by sun, with inner
directories and packages.
For example I have a directory1 with inside two directories and files, the
directories contain other files and directory, etc.
Could someone help me?
Regard.
Maurizio
 
R

Rob Shepherd

maurizio said:
What's the jar command to make a jar like those made by sun, with inner
directories and packages.
For example I have a directory1 with inside two directories and files, the
directories contain other files and directory, etc.
Could someone help me?
Regard.
Maurizio

Hi Maurizio,

You can Add files after jar creation with the u option

<shell>
robshep escher:/homedir/robshep/temp % mkdir temp
robshep escher:/homedir/robshep/temp % cd temp
robshep escher:/homedir/robshep/temp/temp % mkdir a
robshep escher:/homedir/robshep/temp/temp % mkdir b
robshep escher:/homedir/robshep/temp/temp % jar -cvf testjar.jar a
added manifest
adding: a/(in = 0) (out= 0)(stored 0%)
robshep escher:/homedir/robshep/temp/temp % jar -uvf testjar.jar b
adding: b/(in = 0) (out= 0)(stored 0%)
robshep escher:/homedir/robshep/temp/temp % jar -tf testjar.jar
META-INF/
META-INF/MANIFEST.MF
a/
b/
</shell>

or you may do it at creation time by specifying all the files and directories that need to go in it.

<shell>
robshep escher:/homedir/robshep/temp/temp % jar -cvf testjar2.jar a b
added manifest
adding: a/(in = 0) (out= 0)(stored 0%)
adding: b/(in = 0) (out= 0)(stored 0%)
robshep escher:/homedir/robshep/temp/temp % jar -tf testjar2.jar
META-INF/
META-INF/MANIFEST.MF
a/
b/
</shell>

any files or directories may also be fully qualified -> jar -cvf Maurizio.jar /etc/passwd /bin/ls /usr/local/man/

basically jar works like tar but has built in zip stuff.

hth

Rob
 
A

Andrew Thompson

What's the jar command to make a jar like those made by sun, with inner
directories and packages.

Ehhh? I generally point the jar command at a
file list, myself, or if I'm feeling lazy, I just
dump the lot in WinZip and rename the .zip file
to a .jar.

[ I have little idea what you mean by 'inner'
directories, ..is that sub-directories? ]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top