using java on both sides