I am wondering if I can refer to files inside JAR or ZIP files using URLs. I mean, without using a tool (such as the Java Jar utility) but just at the operative system level.

For example, if I have a file myfile in a Jar file myjar, I would like to be able to write something like:

ls -name 'jar:file:/myjar!/myfile'

and see listed the file myfile

The context of this question is that I need to load Prolog files that are zipped in JARs files, but currently I have not discovered how to do this with the console based Prolog interpreter I am using (YAP). In the hope that at the end the command for loading Prolog files will just submit the request to the operative system, I thought that I just need to find out the right way to refer to files inside JAR or ZIP files in such a way that the operative system understands what I am talking about (I am using OSX).


1 Answer 1


The AVFS filesystem presents a view of the filesystem where every archive file /path/to/foo.zip is accessible as a directory ~/.avfs/path/to/foo/zip#. AVFS provides read-only access to most common archive file formats.

Install AVFS (it's provided by many distributions; it requires FUSE, which every modern unix supports). Run this command once and for all (you can run it from your ~/.profile):


And thereafter:

ls /path/to/my.jar\#/myfile

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .