The gearing in your axles must match (+-1%) in order to use 4wd without breaking something. I say +-1% because different axles will vary in ring/pinion gear size and that can affect tooth count. For example, the Dana 30 is 4.10:1 and the Dana 35 is actually 4.11:1.
How to find a 4.10 axle:
-It is the most common ratio associated with 2.5L/manual transmission MJ/XJs. This is no guarantee though, and the ratio should be verified.
-There's a metal tag that comes from the factory attached to a bolt on the diff cover. If it's still there and it's still legible, it'll have either the ratio (4 10) or the tooth counts (41 10) which divided will give the ratio 4.10:1
if the tag is missing, then the following procedure can be used (and probably should be used anyways):
-brace one of the axle shafts still. then rotate the other axle shaft around twice. While you're doing that, watch the pinion closely and count how many times it rotates around. If it rotates around 3 and a half times, it's a 3.55 ratio. If it rotates around just over 4 times, it's a 4.10. If the axle has a limited slip inside and both axles rotate together, then only rotate the axle shafts around one time.
Another option is to remove off the differential cover. The ratio (or the tooth count) should be stamped somewhere on the outside of the ring gear. Be prepared to make a big mess if you pop the cover off.