Code is working fine in Eclipse, but not working here..