13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

28Chapter 1An Embarrassment of Riches: The <strong>Linux</strong> Envir<strong>on</strong>mentTable 1.5 Examples of the zip and unzip commandsCommandunzip -l packedup.zipunzip packedup.zipzip -r packedup mydirExplanati<strong>on</strong>Gives a table of c<strong>on</strong>tents of the archive with some extra frillaround the edges, like a count of the files in the archive.Extracts all the files from the ZIP file, creating themaccording to their specified pathname, assuming your userID and file permissi<strong>on</strong>s allow it. Add the quiet opti<strong>on</strong> with-q if you would like unzip not to list each file as it unzips it.Creates a ZIP archive named packedup.zip from themydir directory and its c<strong>on</strong>tents. The -r tells zip torecursively descend into all the subdirectories, theirsubdirectories, and so <strong>on</strong>; otherwise, zip will just take thefiles at the first layer and go no deeper.TIPSince TAR and ZIP files can c<strong>on</strong>tain absolute as well as relative pathnames, itis a good idea to look at their c<strong>on</strong>tents (e.g., tar tvf file) before unpackingthem, so that you know what is going to be written where.There are many, many more opti<strong>on</strong>s for tar and zip that we are not coveringhere, but these are the most comm<strong>on</strong> in our experience, and they will giveyou a good start.The tar and zip commands are also worth knowing about by a Java developerbecause of their relati<strong>on</strong>ship to JAR files. If you are working with Java youwill so<strong>on</strong> run across the noti<strong>on</strong> of a Java ARchive file, or JAR file. They arerecognizable by name, ending in .jar. Certain Java tools are built to understandthe internal format of JAR files. For Enterprise Java (J2EE) there aresimilar archives known as WAR files and EAR files. The command syntax fordealing with the jar command that builds these archives is very similar to thebasic commands of tar. The internal format of a jar is the same as a ZIP file.In fact, most places where you can use a JAR file you can use a ZIP file as well.(You will see more about this when we discuss the standard Java tools inSecti<strong>on</strong> 5.11.)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!