For my usecase, I must come with an in memory directory to keep some files for any very small amount of time. Really I compile source code to .class files at runtime, classload and execute them. The clean way is always to produce a virtual directory and allow the compiler create .class files there. Obviously I could make use of a temp directory, but I must fix it before producing, I'm not sure if I am the only person utilizing it, etc.
So, is and just how can you really produce a virtual* directory in java?
*virtual within the concept of in memory.
It may sound like you could utilize a ramdisk. You will find many applications available that is going to do this, that which you use would rely on the prospective OS. I'm not sure associated with a native Java API that supports this.
I don't know if this sounds like useful or otherwise, but check Apache Commons VFS.
It appears that the thing you need is memory filesystem.
In Java 6 it's not really possible to get this done type of factor inside a Java application. You have to depend around the OS platform to supply the the pseudo-filesystem.
In Java 7, the NIO APIs happen to be extended to supply an SPI that enables you to definitely define new types of file system see [cde].
Apache Commons VFS is yet another option, but it features a handful of qualities that could create problems for existing code and (3rd-party) libraries:
Files and sites in VFS are named using web addresses, not
FileSystemProviderobjects. So code that utilizes
Filefor file manipulation will not work.
FileReaderwill not use VFS for very similar reason.