Originally Posted by pokey
This might sound too simple but check your battery and connections. A weak battery will cause an engine to run rough. If your battery is almost shot the alternator isn't enough to keep the engine running smoothly.
X2. The TJ's alternator won't put ANY power out if the battery is dead, and it will put out weak power if the battery is weak. Without a good battery, the engine either won't run or it will run badly depending on the battery's condition.
Yes we know that SOME vehicle alternators and all generators will run fine with a dead or weak battery, just not the type of alternator used in the Wrangler.
If it's not the battery or a loose/dirty/corroded battery connection (no, a visual check is not good enough to tell if it's ok), then odds are fairly good that either the crankshaft position sensor or camshaft position sensor has gone bad.