Cleanup and fix java and scala pipe examples