Enable java support

I've locally tested this with Linux, MacOS and Windows. I think it's pretty isolated and safe to merge.