Where Huck feels he must run away from his father, Pap Finn, he runs away with Jim. Huck is coddled and crooned over by Jim, while he is beaten and treated with suspicion by his father.
The two men both serve to prove a point about Huck Finn's lack of real family, as Jim has a family of his own and Huck's father is incapable of affection or actual parentage.
In some significant ways Jim and Pap are nearly exact opposites:
Jim is one novel's most appealing adult characters in the book, a gentle and loyal individual, who does not hate, cheat or trick anyone, who fears and evades violence but never commits any.
Pap is not gentle or loyal and seeks to cheat and trick people as often as it suits him (which is often) and enacts violence upon his son. While Pap inspires Huck to flight, Jim inspires loyalty in Huck and ultimately serves as the object of Huck's final step toward moral maturity in the novel.
It is Jim, a loyal friend, who inspires Huck to choose his own moral path. Pap, on the other hand, represents a path Huck does not want to take.
Pap is a failure as a father and as a white man, and whether he knows it or not Huck aspires to more.
Jim represents an opportunity for Huck to grow and to demonstrate that growth by helping him. The affectionate and patient man is a counter to the selfish and violent Pap.