fix java issues while compiling with v6 and v7