To run your standalone program you have to set up your classpath correctly. To run your servlet you have to set up your web application correctly. This has nothing to do with the code and everything to do with configuration. So it's perfectly possible to get one right and one wrong, and you've done that.
So whining for us to run your code is not useful, since it's the configuration which is the problem, not the code, and you haven't shown us your configuration.
If you're wondering what configuration I'm talking about, well, Jesper already told you what to do. It sounds like you decided to reject that advice and post that last unfortunate post instead.
If you want to look young and thin, hang around old, fat people. Or this tiny ad: