James Xavier McLanahan was born near Greencastle, Pennsylvania in 1809. He was the grandson of renowned Pennsylvania political figure Andrew Gregg (1755-1835) and second cousin to Andrew Gregg Curtin, Class of 1837. He graduated from Dickinson College with the class of 1827, studied law, qualified to the Franklin County bar and set up a practice in Chambersburg, Pennsylvania.
In late 1841, he was elected to the state senate and served there between 1842 and 1844. He was elected as a Democrat from the Sixteenth District to the United States Congress for its 31st and 32nd sessions, serving between March 1849 and March 1853. While in Washington, he was the chair of the House Committee on the Judiciary, but declined renomination in 1852.
James Xavier McLanahan died in New York City
on December 16, 1861 and was buried in Chambersburg. He was 52 years