Sounds like The Invisible, starring Justin Chatwin. Turns out he wasn't all the way dead, but he was left for dead. He finds out he's just a spirit when he's screaming in the classroom and no one answers, then he tries to knock stuff off of desks and things and nothing moves. In The Sixth Sense, the boy isn't the one that's dead and there aren't any classrooms except in the scene where the main character gets in trouble for saying they used to hang people in the school. I could have sworn I had written the review on it, but seem to have misplaced the darn thing.