Most of the time, dogs want to jump up, because they want to be in the same level with you.
I'd say that the best way is the way that Jean told you.
Teach him to sit or lay down when you're in a situation in which he can jump up.
If he understands, that he will only get praised if he does what you ask him to do (sitting down instead of jumping up), it would be a lot easier, and he would be happier too.
Don't knee your dog, only if you have a Very serious reason to do that. If you have other choises, use those.
Hope I could help some...