So how does James' thought on justification by faith and works (v.24) relate to Paul's thought on justification by faith (Rom. 4 and Gal. 2)? I think James' thought can be harmonizes with Paul's, but I also think it's important to note that James' main point is to stress that good works is important for salvation and not to give a dissertation on how faith, works, and justification (salvation) are related.
Differences in Paul and James
I think the best way to harmonies Paul and James is to note the following differences:
1. Paul and James appears to have different definitions of faith.
Robert Stein notes that "the faith of James's opponent involves merely intellectual assent to propositions such as "God is one." It is a belief that certain propositions are true. Paul's use of the words "faith" and "believe" involves faith in God and his Son. It is not merely propositional, although that element is present. It is also relational! Faith for Paul involves a relationship of grace and love toward God that results in a transformed life" 
2. In Romans and Gal, Paul's tension is between faith and "works of the law" (Mosaic law) and not "good works" in general.
Richard Bauckham writes " When Paul refers to "works of the law" (a phrase not used by James) it is with special, though not exclusive, reference to boundary markers, such circumcision and food laws, which symbolized Jewish exclusivity. James, on the other hand, is entirely oblivious to the question of Gentile believers in Christ, and the works he has in mind are acts of neighborly love." 
3. Paul seems to have a more realized understanding of justification while James has a more futuristic (eschatological) one. 
With these points in mind, I believe James is stressing the importance of the final judgment in accordance with works (Romans 2:), while Paul is stressing the importance of initial or realized justification by faith alone over and against those who are obedient to the Mosaic law 
 pg 6 of "Saved by Faith [Alone]" in Paul "Not Saved faith Alone" in James by Robert Stein.
 pg 1488 of Eerdmans Commentary on the Bible.
 See Gathercole on pg 234 in "Justification in Perspective" (McCormack), M. Seifrid on pg 182 in "Christ, our Righteousness", and pg 13 and 14 of R. Stein's article mentioned above.
 Even though James states a person is "justified by works" and not "will be justified by works". I think James is using proleptic language (bringing in the future verdict into present) to stress the importance of having good works in the present because the final verdict is in accordance with it.