Do not grumble against one another, brothers, so that you may not be judged; behold, the Judge is standing at the door. (ESV)
You know what you are made of when you are forced to go through a time of great persecution. I know that we would probably all prefer to never be persecuted, but just as the Savior was tempted, tried, and even tortured to death, we also will face times of temptation, trial, and in one degree or another some kind of torture for our faith.
How do you respond when the heat is turned up in your personal situation? Are you able to maintain your cool? Or do you lash out at those around you? James has been talking about a situation of wealthy oppressors of the Christians. He has assured them that God will judge their oppressors, but he now instructs them to be sure that while they await God's judgment they do not grumble at one another.
I would love to say that James had no need to tell these believers not to grumble, but I do believe that he understood our fallen human nature. In fact, I believe that the enemy of our souls tries to get us to question God's goodness and complain about our situation. Once we give in to grumbling and complaining we completely lose our focus on God and we fall in to sin.
As you consider the last part of this verse you need to realize what James means by Jesus being the judge standing at the door. He is a judge who wants to reward us for our perseverance through the trials that he has allowed to come our way. James warns us that we will lose some of our reward by our grumbling.
You are either facing trouble, or you will be soon. Prepare your heart. Ask the Savior to help you fix your eyes firmly on him. He will give you the strength you need.