Compressing server into .jar file Currently I'm attempting to compress a decompressed jar file that I have changed into a jar file. How can I do this via the command line? I know that there is a jar command in terminal, I'm just having trouble learning how to compress that folder.

If the folder's directory (probably not correct term, but hopefully you get the idea) is /Users/Odinulf/folderone/foldertwo (foldertwo is directory that I want compressed), what would be the exact code to do this?

Thanks in advance,

Odinulf
cd /Users/Odinulf/folderone
jar cvf myjar.jar foldertwo


For example:

/Users/ian/code/tmp [ian@Ian-Cs-MacBook-Pro] [19:13]
&gt; jar cvf myjar.jar 8779 
added manifest
adding: 8779/(in = 0) (out= 0)(stored 0%)
adding: 8779/.DS_Store(in = 6148) (out= 355)(deflated 94%)
adding: 8779/logs/(in = 0) (out= 0)(stored 0%)
adding: 8779/logs/MasterLog.txt(in = 3044043) (out= 207357)(deflated 93%)
adding: 8779/logs/StartLog.txt(in = 6984480) (out= 685836)(deflated 90%)
/Users/ian/code/tmp [ian@Ian-Cs-MacBook-Pro] [19:13]
&gt; ls *.jar
myjar.jar


Breaking it down, the options are:


c - create a jar file
v - be verbose when you do it
f - put the bitstream in to a file instead of standard out


Then you give it the file to put the bitstream in to. In this case myjar.jar. And then you give it a list of directories and files to put in to that jar bitstream. Relative and absolute pathing for contents is generally maintained so be careful with that.