These problems are relatively simple to diagnose, and it really helps if you have a meter and have a fundamental knowledge of how to use it.
Always start with removing battery cables, cleaning them and the battery posts until SHINY. Connections as mentioned by others, are often suspect. Then LOAD TEST the battery. It is the only accurate way of determining battery condition.
Okay, still doing it AFTER the above is verified? Get that meter. Buy one if you don't own one. Everybody that works on their XJ needs to own a meter. With the key in the on position, put the meter directly on the starter. You should have approximately full battery voltage there.
If you have full battery voltage at the starter, the problem is THE STARTER. Even if it is newer.
However, if you don't have full battery voltage at the starter, you have to start working your way back into the engine bay to find out why. Common causes include a bad cable, bad ground, connection, etc.
99 Cherokee, 4.0 AW4, NP242
Past Jeeps: 49 Willys, 81 Scrambler, 88 Comanche
Without "data", all you have is an opinion!