Java API bugfixes for cygwin compilation

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>