I believe that you are confusing Andrew Jackson with Thomas Jefferson. Jefferson was the president when Eaton, et. al, fought the Muslims at Tripoli.
It was Jefferson who started the action against them, but his Secretary of State screwed Eaton and it was left to Monroe, I believe, to really end their piracy for good. Jackson did some good. He cleaned the Brits clock in Florida,hanged a British agitator he caught stirring up the Seminoles, won the Creek War, suppressed South Carolina when it attempted to defy Federal Law (not so good?), and was responsible for the Trail of Tears, screwing tribesmen who were his allies in tge Creek War. He also cheated at duels, but then he WAS a Democrat.