Нашел ответ:
1.If you're running inside an IDE like Eclipse or IntelliJ, you have to add the JAR to a library.
2.IF you're running in a command shell, use the -p option for javac.exe when you compile and java.exe when you run.
3.If you're using it in a web app, you can start by putting it in the WEB-INF/lib directory of your WAR file. If you're using a servlet/JSP engine like Tomcat 6, put it in the Tomcat /lib directory.
мне помогло пункт 3.