If it shuts down when unplugged, then the battery is bad. It only takes about two weeks to a month of not being connected to power for the battery to be permanently damaged. Laptops should remain plugged in at all times or the battery removed from the unit, and even then I don't recommend going longer than a week without charging the battery. When the battery is fully discharged for long periods of time it can in some cases lose it's charging "memory" and although the battery might physically be undamaged, it will not accept a charge and will therefore be essentially useless.
It's also possible that the power jack is damaged and is simply not charging the battery, but this is much less common than a faulty battery and if the battery...