If you really fulfill the royal law according to the Scripture, “You shall love your neighbor as yourself,” you are doing well. (ESV)
Do you fulfill the royal law? We find this law that James is referring to in Leviticus 19:18. This Law that was given through Moses said: "You shall not take vengeance or bear a grudge against the sons of your own people, but you shall love your neighbor as yourself: I am the LORD. Jesus himself referred to this law when he summarized all of the prophets as being hinged upon two basic laws: Love the Lord your God with all your heart and love your neighbor as yourself.
In the context of this passage James is referring to how we treat others, specifically without favoritism. Imagine again the illustration that James gave of two different people walking into a church gathering; one rich and one poor. If we are truly loving our neighbor as our self we will not tell the poor man to take a seat in the back.
As for this idea of loving one self James is not advocating for some kind of selfishness that would be an ideal. Rather, he is suggesting that if we recognize that we are all made in God's image we have the ability to love ourselves and love others. In fact, if we hate ourselves it will be very difficult to love another person.
James challenges the church to put our faith into action. It is one thing to make a claim that we have faith in God, but we need to prove that faith by the way that we act. Part of those actions that prove our genuine faith in God include the way that we treat others. We must love others the way that we would desire to be loved.
Do you fulfill the royal law? Do you love your neighbor as your self? This is one of the ways that we can prove that our faith in God is real.