rsync from within Java

One thing that I have been missing lately was a nice Java library that provides rsync-like functionality. But I didn’t really find anything suitable, so I decided to write a Java wrapper for it myself, trying to make it as easy as possible to integrate rsync into Java applications.

The wrapper approach wasn’t an issue for Linux and Mac OSX, as these operating systems already have native rsync binaries. The problem, like most of the times, is Windows. My solution for this was to use the binaries from a 64-bit version of cygwin. Only rsync and ssh are required as binaries to perform synchronization. For Windows, that required a few more DLLs, unfortunately. In the end, I decided to set up a little mini-cygwin with just ssh and rsync in the user’s home directory (%USERPROFILE%\rsync4j). This approach also allows the storage of public key pairs in %USERPROFILE%\rsync4j\home\%USERNAME%\.ssh, making it easier for password-less synchronization.

Here is the project homepage:

Early stages, so bugs are to be expected. 😉