When James mentions grumbling here, he connects it to the second coming of Jesus, except that on this occasion he describes Jesus as the Judge. The picture James uses is that of the Judge observing what is happening and listening to what is said.
Obviously, this fits with James’ ongoing comments on the misuse of the tongue. It may be the case that times of opposition are occasions when grumbling is more likely. Yet grumbling, whenever it occurs, is an inaccurate comment on the providence of God, and is obviously not an expression of brotherly love.
Instead of grumbling, James says that his readers should think about Old Testament examples of persevering in times of trial. The first example are the Old Testament prophets who remained steadfast in times of severe opposition. We should be able to recall what happened to some of them. Jeremiah was placed in a pit, Daniel was put in a den of lions, and Isaiah was sawn in two. The message given to each by God resulted in very strong opposition and several paid for their testimony with their lives. But they persevered!
The second example mentioned by James is an individual, Job. We know his story, how he had to persevere in his faith through a sequence of tragedies involving his possessions, his family and his health. How did Job cope with his troubles? He did not get much help from the advice of his friends. Instead he thought of the coming of the Lord.
We are familiar with the words recorded in Job 19:25-27: ‘For I know that my Redeemer lives, and at the last he will stand upon the earth. And after my skin has been thus destroyed, yet in my flesh I shall see God, whom I shall see for myself, and my eyes shall behold, and not another. My heart faints within me!’
In that verse, he accepts the possibility that things in this life might get even worse for him, yet he also affirms that eventually he would meet with God in the form of a Redeemer, a wonderful description of Jesus. And so he persevered.