In Java 6 on Windows, I am interested in performing the following task, but really not sure how to go about it.
I know it sounds weird, but it will actually make something much more efficient by doing it this way, so if its possible, it would be great to know.
It sounds difficult, and it will definitely require a lot of stuff that cannot be done in pure Java.
On Linux, I think you would need to do the following:
Create and mount a "tmpfs" - https://unix.stackexchange.com/questions/66329/creating-a-ram-disk-on-linux
Unzip the ZIP file into the tmpfs
Run the .exe using ProcessBuilder ... which allows you to set the child processes current directory.
etcetera
Unmount the "tmpfs" when you've done.
The commands for creating the "ram disk" file system will be OS specific, and may require root / administrator privilege.
It is unclear whether doing this will be more efficient than using a temporary directory in the file system. I wouldn't attempt this unless there was a clearly demonstrated need for a solution that it more efficient; ie unless you've tried using a temporary directory and found that it is too slow.
Bear in mind that:
much (maybe most) of the work of unpacking the ZIP file has to be done either way you do it, and
in the conventional case your .exe will probably be reading the files from the expanded ZIP out of the OS'es in-memory disk-block cache (on Linux).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.