How to make something like a jar file?

I was wondering how i would make somethign like a jar file, basically a folder that cant be opened without special software, something that holds files like exe's, text files, etc, basically any type of file. how would i do that?
Correct me if I'm wrong but jar files are used for Java programming, not C++. Try a different forum for your answer.
Nono, i dont want to make a jar file, a jar file holds files, i want to do somethin g like that with c++ i want to make a C++ version of a jar file. a file that cant be opened unless it has special software. I basically want to make my own version of a zip file, except i dont want anyone to be able to open it without special software that i make.
Last edited on
The JAR file format is built on the ZIP file format with the .jar file extention. Taken from wikipedia (http://en.wikipedia.org/wiki/JAR_%28file_format%29)
The ZIP file format uses the LZ77 and LZ78 (and Huffman coding) algorithms.
You can use these algorithms within a library at zlib.net.
The png file coincidentally also uses the same algorithm to compress 3 or 4 channel bitmap images.
is there any easier ways? can i just make a folder that cant be opened? thats all i really want, i dont really care about compression.
can i just make a folder that cant be opened?


No. If you put a directory on someone else's machine, they can get into it. It is their machine. They can read anything they like from the hard drive.

If you want to do this, you will have to put all your files into one big file, and obscure the way you did it, so that the end user cannot break the file down easily into the components. If you obscure it using a well-known system (as is done in jar files) the end user will be able to get into it using the right tool (like jar files). If you write your own system, they will not.

The easiest way is as Nexius said. Just use an existing compression library. They are very easy to use and much easier than writing your own.
Last edited on
You could encrypt your files and then use a loader which knows how to unencrypt the files to run or load. Or even store all files in one big one, with an index to find the individual files.

But then you've got to worry about protecting the in-memory data, which is even more complicated.

Andy
No. If you put a directory on someone else's machine, they can get into it. It is their machine. They can read anything they like from the hard drive.


Assuming it's not a multiuser machine.
When I say "someone else's" I mean the person who is the physical possessor. A user is just a user; it may or may not be their machine.
Last edited on
Topic archived. No new replies allowed.