This web site contains a number of links to Java programs that were
covered in lectures. These links are typically labelled with the
suffix jar. On this web page, I explain how to
take copies of these files.
- Download: Do not use your left mouse button to
follow the hyperlink! If you do, the page that appears will contain
quantities of apparent gobbledegook. Cutting-and-pasting this
gobbledegook into another file is a completely pointless thing to do.
This will not work!
Instead…
Click on the hyperlink using your mouse's right button. A menu should appear and one of the options on the menu will be
Save. Use this to save the file in some suitable part of your home directory. - Unpack: The file you have saved may contain
several other files. They were concatenated together and compressed
using a Java tool called
jar. To extract the files, we again usejar.Suppose the file is called
agentDemonstrator.jar. To extract its contents, type the following:jar xf agentDemonstrator.jar
If you now list your current directory, you should find new files or directories. In this example, you'll find a new directory called
agentDemonstrator. The Java program is in this subdirectory.There are many more sophisticated things you can do with
jar. If you want to know about them, consult our local copy of the Java tools reference page. - Tidy up: You can save disk space and keep your
directories tidy by deleting two things: the
jarfile (e.g.agentDemonstrator.jar) and another directory that gets created calledMETA-INF.