*Minor differences ignored. Grouped by changes, with first version listed as example.
Draw nigh to God. He again reminds us that the aid of God will not be wanting to us, provided we give place to him. For when he bids us to draw nigh to God, that we may know him to be near to us, he intimates that we are destitute of his grace, because we withdraw from him. But as God stands on our side, there is no reason to fear succumbing. But if any one concludes from this passage, that the first part of the work belongs to us, and that afterwards the grace of God follows, the Apostle meant no such thing; for though we ought to do this, yet it does [not] immediately follow that we can. And the Spirit of God, in exhorting us to our duty, derogates nothing from himself, or from his own power; but the very thing he bids us to do, he himself fulfills in us. In short, James meant no other thing in this passage, than that God is never wanting to us, except when we alienate ourselves from him. He is like one who brings the hungry to a table and the thirsty to a fountain. There is this difference, that our steps must be guided and sustained by the Lord, for our feet fail us. But what some cavil at, and say, that God's grace is secondary to our preparation, and as it were the waiting-maid, is only frivolous; for we know that it is no new thing that he adds now to former graces and thus enriches more and more those to whom he has already given much. Cleanse your hands. He here addresses all those who were alienated from God and he does not refer to two sorts of men, but he calls the same sinners and double-minded Nor does he understand every kind of sinners, but the wicked and those of a corrupt life. It is said in John 9:3, "God does not hear sinners;" in the same sense a woman is called a sinner by Luke. (Luke 7:39.) It is said by the same and the other evangelists, "He drinketh and eateth with sinners." He, therefore, does not smite all indiscriminately to that sort of repentance mentioned here, but those who are wicked and corrupt in heart, and whose life is base and flagitious or at least wicked; it is from these he requires a purity of heart and outward cleanliness. We hence learn what is the true character of repentance. It is not only an outward amendment of life, but its beginning is the cleansing of the heart. It is also necessary on the other hand that the fruits of inward repentance should appear in the brightness of our works. 
1 - In the seventh verse he seems still to continue military terms, "Set yourselves, therefore, in array under God: stand up against the devil, and he will flee from you." It is especially to be observed, that the first thing is to be under the banner and protection of God, and then we can successfully stand up against the devil: apart from God, we have no power to resist him. The order in the following verse, the eighth, is worthy of notice, as an example of what is very common in Scripture. The main thing is first stated, to draw nigh to God: and then the things which are previously necessary, to cleanse their hands and to purify their hearts -- an allusion probably to the practice among the priests of the law, of washing themselves before they engaged in the service of the temple. They were to wash their hands as though they had been stained with blood, as the crime of murder had been imputed to them in James 4:2: and they were to purify their hearts from the covetings and ambitious desires which they had entertained. Except those things were done they could not draw nigh to God. And further, to draw nigh to God was necessary before they could set themselves in array under his authority, so that there is a connection between this verse and the former: the ultimate object, stated first, was submission to God, and to be under his protection; and all that follows was necessary for that purpose. The regular order would be, Purify your hearts, cleanse your hands, draw nigh to God, and be subject to him. But this mode of statement, by going backward instead of forward, is to be met with in all parts of Scripture. See on this subject the Preface to the third volume of Calvin's Commentaries on Jeremiah.
Draw nigh to God, and he will draw nigh to you - Compare 2-Chronicles 15:2. This declaration contains a great and important principle in religion. If we wish the favor of God, we must come to him; nor can we hope for his mercy, unless we approach him and ask him for it. We cannot come literally any nearer to God than we always are, for he is always round about us; but we may come nearer in a spiritual sense. We may address him directly in prayer; we may approach him by meditation on his character; we may draw near to him in the ordinances of religion. We can never hope for his favor while we prefer to remain at a distance from him; none who in fact draw near to him will find him unwilling to bestow on them the blessings which they need.
Cleanse your hands, ye sinners - There may possibly be an allusion here to Isaiah 1:15-16; "Your hands are full of blood; wash you, make you clean; put away the evil of your doings from before mine eyes; cease to do evil." The heart is the seat of motives and intentions - that by which we devise anything; the hands, the instruments by which we execute our purposes. The hands here are represented as defiled by blood, or by acts of iniquity. To wash or cleanse the hands was, therefore, emblematic of putting away transgression, Matthew 27:24. Compare Deuteronomy 21:6; Psalm 26:6. The heathen and the Jews were accustomed to wash their hands before they engaged in public worship. The particular idea here is, that in order to obtain the favor of God, it is necessary to put away our sins; to approach him with a desire to be pure and holy. The mere washing of the hands, in itself, could not recommend us to his favor; but that of which the washing of the hands would be an emblem, would be acceptable in his sight. It may be inferred from what is said here that no one can hope for the favor of God who does not abandon his transgressions. The design of the apostle is, evidently, to state one of the conditions on which we can make an acceptable approach to God. It is indispensable that we come with a purpose and desire to wash ourselves from all iniquity, to put away from us all our transgressions. So David said, "I will wash my hands in innocency; so will I compass thine altar. O Lord," Psalm 26:6.
("To obtain the favor of God, it is necessary to put away our sins" - is somewhat unguarded phraseology. If the favor of God were not obtained but on this condition, none ever would obtain it. The passage is a strong injunction to holiness and singleness of heart: it does not say, however, that by these we obtain acceptance with God. Of his favor, holiness is the fruit, the effect, and not the cause. The sinner must not think of getting quit of his sins to prepare him for going to God by Jesus; but he must first go to Jesus to prepare for laying aside his sins. Yet in every approach to God, it is true there must be a "desire "to be free from sin; and this doubtless is the view of the commentary; indeed it is so expressed, though some words are objectionable.)
And purify your hearts - That is, do not rest satisfied with a mere external reformation; with putting away your outward transgressions. There must be a deeper work than that; a work which shall reach to the heart, and which shall purify the affections. This agrees with all the requisitions of the Bible, and is in accordance with what must be the nature of religion. If the heart is wrong, nothing can be right. If, while we seek an external reformation, we still give indulgence to the secret corruptions of the heart, it is clear that we can have no true religion.
Ye double-minded - See the notes at James 1:8. The apostle here seems to have had his eye on those who were vacillating in their purposes; whose hearts were not decidedly fixed, but who were halting between good and evil. The heart was not right in such persons. It was not settled and determined in favor of religion, but vibrated between that and the world. The proper business of such persons, therefore, was to cleanse the heart from disturbing influences, that it might settle down in unwavering attachment to that which is good.
Draw nigh to God - Approach Him, in the name of Jesus, by faith and prayer, and he will draw nigh to you - he will meet you at your coming. When a soul sets out to seek God, God sets out to meet that soul; so that while we are drawing near to him, he is drawing near to us. The delicacy and beauty of these expressions are, I think, but seldom noted.
Cleanse your hands, ye sinners - This I think to be the beginning of a new address, and to different persons; and should have formed the commencement of a new verse. Let your whole conduct be changed; cease to do evil learn to do well. Washing or cleansing the hands was a token of innocence and purity.
Purify your hearts - Separate yourselves from the world, and consecrate yourselves to God: this is the true notion of sanctification. We have often seen that to sanctify signifies to separate a thing or person from profane or common use, and consecrate it or him to God. This is the true notion of קדש kadash, in Hebrew, and ἁγιαζω in Greek. The person or thing thus consecrated or separated is considered to be holy, and to be God's property; and then God hallows it to himself. There are, therefore, two things implied in a man's sanctification:
1. That he separates himself from evil ways and evil companions, and devotes himself to God.
2. That God separates guilt from his conscience, and sin from his soul, and thus makes him internally and externally holy.
This double sanctification is well expressed in Sohar, Levit. fol. 33, col. 132, on the words, be ye holy, for I the Lord am holy: אותו מלמעלה ארס מקדש עצמו מלמטה מקישין, a man sanctifies himself on the earth, and then he is sanctified from heaven. As a man is a sinner, he must have his hands cleansed from wicked works; as he is double-minded, he must have his heart sanctified. Sanctification belongs to the heart, because of pollution of mind; cleansing belongs to the hands, because of sinful acts. See the note on James 1:8, for the signification of double-minded.
Draw nigh to God, and he will draw nigh to you,.... This must be understood consistently with the perfection of God's immensity and omnipresence: the saints draw nigh to God when they present their bodies in his sanctuary; when they tread in his courts, and attend his ordinances; where they always find it good for them to draw nigh unto him; and blessed is the man that approaches to him in faith and fear: they draw nigh to him when they come to the throne of his grace, for grace and mercy to help them; when they draw near to him in prayer with true hearts, and lift them up with their hands to God; when in the exercise of faith and hope they enter within the vail, and come up even to his seat; and lay hold on him as their covenant God and Father; and he draws nigh to them by granting them his gracious presence, by communicating his love to them, by applying the blessings of his grace, by helping them in times of need and distress, and by protecting them from their enemies; the contrary to which is expressed by standing afar off from them. Now this is not to be understood as if men could first draw nigh to God, before he draws nigh to them; for as God first loves, so he first moves; he takes the first step, and, in conversion, turns and draws men to himself; though this does not respect first conversion, but after acts in consequence of it; nor is it to be considered as a condition of the grace and favour of God, in drawing nigh to his people, but is expressive of what is their duty, and an encouragement to it:
cleanse your hands, ye sinners, and purify your hearts, ye double minded; the persons addressed are not the profane men of the world, but sinners in Zion, formal professors, hypocritical persons; who speak with a double tongue to men, and who draw nigh to God with their mouths, but not with their hearts; who halt between two opinions, and are unstable in all their ways: cleansing of their hands and hearts denotes the purity of outward conversation, and of the inward affections; and supposes impurity both of flesh and spirit, that the body and all its members, the soul and all its powers and faculties, are unclean; and yet not that men have a power to cleanse themselves, either from the filth of an external conversation, or from inward pollution of the heart; though a man attempts the one, he fails in it; and who can say he has done the other? Job 9:30. This is not to be done by ceremonial ablutions, moral services, or evangelical ordinances; this is God's work only, as appears from his promises to cleanse his people from their sins, by sprinkling clean water upon them; from the end of Christ's shedding his blood, and the efficacy of it; and from the prayers of the saints, that God would wash them thoroughly from their iniquity, and cleanse them from their sin, and create clean hearts in them: and yet such exhortations are not in vain, since they may be useful to convince men of their pollution, who are pure in their own eyes, as these hypocritical, nominal professors, might be; and to bring them to a sense of their inability to cleanse themselves, and of the necessity of being cleansed elsewhere; and to lead them to inquire after the proper means of cleansing, and so to the fountain of Christ's blood, which only cleanses from all sin.
Draw nigh to God--So "cleave unto Him," Deuteronomy 30:20, namely, by prayerfully (James 4:2-3) "resisting Satan," who would oppose our access to God.
he will draw nigh--propitious.
Cleanse . . . hands--the outward instruments of action. None but the clean-handed can ascend into the hill of the Lord (justified through Christ, who alone was perfectly so, and as such "ascended" thither).
purify . . . hearts--literally "make chaste" of your spiritual adultery (James 4:4, that is, worldliness) "your hearts": the inward source of all impurity.
double-minded--divided between God and the world. The "double-minded" is at fault in heart; the sinner in his hands likewise.
Then draw nigh to God in prayer, and he will draw nigh unto you, will hear you; which that nothing may hinder, cleanse your hands - Cease from doing evil. And purify your hearts - From all spiritual adultery. Be no more double minded, vainly endeavouring to serve both God and mammon.
*More commentary available at chapter level.