James 2:17 comes up a lot with misbehaving Christians. Actually, it's usually quoted in hypothetical situations, but rarely does someone have the guts to apply it the same way to a specific situation involving themselves or someone they know. Here's what I mean:
We hear about hypocritical Christians misbehaving fairly often. They smoke, drink, chew and run with girls who do. And we're quick to quote James 2:17 in their situation. "Well, I've got to question whether or not they're really a believer. You know, James says "faith without works is dead..."
But when someone calls us on our gossip, or our bad attitude, or our choice of language when the Dallas Cowboys false start on the goal line... again... James 2:17 couldn't be further from our mind.
And, it's just as well. Because I think it's pretty dangerous to apply James' words about faith without works to a person's eternal salvation. If James is saying that a person's faith, without works before, during or after salvation is not enough for them to be assured of heaven, we've got a huge problem because Paul says the opposite.
James isn't saying that if you don't have good works you are going to miss heaven. He has made it clear up to that point in his book that he assumes the people he's writing to are going to heaven (James 2:1).
If you look at that whole chapter, James is reminding Christian people that their works are important; not so they can be confident of heaven, but so that others can see their faith. James is writing about the importance of being a good reflection of Jesus. And he challenges his readers: You show me your faith while being a deadbeat, and I'll show you my faith by what I do... let's see whose life is the most compelling testimony of Christ to the world.
Christians should absolutely have good works in their lives; not so they can prove to other Christians that they're going to heaven, but so that they can prove to the rest of the world that because of what Christ has done our eyes are on a different and better kingdom (James 2:5) with a different and better Law (James 2:12).
As a pastor, I've seen a few dead bodies in my life. And frankly, I think dead bodies are pretty weird. Why? Because those bodies are not supposed to be like that. They weren't created to look pretty in a casket. They were created to walk, talk, hug, love, smile, eat, and enjoy life. Death is a consequence of sin - not what we were created to do.
As a believer, we are created in Christ Jesus to do good works (Ephesians 2:10) so that God can show the riches of His grace to the world (Ephesians 2:7). When Christians don't live lives of good works, they're like bodies lying in a casket - not doing what they were created to do. In that way, faith without works is dead. That's James' point.
It doesn't mean that you aren't going to heaven... just means when it comes to showing your faith (2:18) you're as worthless as a body lying in a casket.