Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a virtual disk (letter, share, etc.) on Windows using Java?

I'm looking at trying a project for class and as part of it I will need to create a "disk" to allow users to write some files (e.g. a RAM disk). I've used various languages, but I'm most familiar with Java (I could maybe use C# and get it done in time). I'm wondering what is out there that can do this.

I've looked at Commons VFS, JLAN and Alfresco and I might be able to use the latter two but I'm wondering if there are other options. Right now I'm looking at Java 7 which I read has new I/O stuff that might help... Really the main thing I need to figure out at this point is a way to map a drive. For example, AFAICT, Commons VFS would let me access files somewhere (like FTP), but how can I present this access as a drive letter or share this can be mapped?

Thanks

Update: To be more clear, what I'm trying to do (generally) is create something like Dropbox. I want to have a drive letter/share in Windows but the back-end will be something other than a local disk (like another machine on the LAN which runs a server component). I need to at least code the back-end logic to transfer data, but am unsure how to "glue" it into Windows such that it appears to be a disk or network share... It seems that using some sort of CIFS service and exposing that to the OS might make the most sense.

like image 571
Josh Avatar asked Dec 17 '25 15:12

Josh


2 Answers

You can use our Callback File System product to create a virtual filesystem and expose it via drive letter or folder on NTFS disk. Filesystem operations will be handled by your code and you will be able to transfer the data to the cloud. This is the scenario used by dozens of our clients.

like image 105
Eugene Mayevski 'Callback Avatar answered Dec 19 '25 05:12

Eugene Mayevski 'Callback


In pure Java you will not be able to create a client side application but will have to create a server application that speaks something Windows already knows how to mount (CIFS or Web DAV for example). WebDAV would likely be the simplest to work with.

Now you mention Dropbox in your post. Dropbox I don't believe actually creates a virtual drive or folder but rather replicates content to a local folder and the monitors said folder for changes. If you select that route then Java has a WatchService to handle it (complete with tutorial). You would have to write both client and server side component but your files will be available while you are offline.

like image 30
Michael Lloyd Lee mlk Avatar answered Dec 19 '25 05:12

Michael Lloyd Lee mlk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!