James W. Ryan was born in Norwegian Township, Pennsylvania. He moved to Mahanoy City, Pennsylvania, with his parents, where he attended the public schools. He graduated from the high school of Frackville, Pennsylvania. After this he was a school teacher for a short time. He studied law, was admitted to the bar in 1884 and commenced practice in Pottsville, Pennsylvania. He was elected district attorney in 1892 and served until January 1896.
Ryan was elected as a Democrat to the Fifty-sixth Congress. After his time in Congress, he resumed the practice of law and died in Mahanoy City in 1907. He was buried in the Holy Rosary Cemetery in Frackville.