Every time im trying to access a normal java class from servlet (from other project) it gives me classNotFound exception, any idea how to fix this problem开发者_如何学编程 thanks in advance
You need to make sure that the class is available to the servlet container. How you do that will partly depend on exactly what servlet container you're using, but you could always put the jar file in WEB-INF/lib
or the class file in WEB-INF/classes
(under the right folder structure of course).
Hopefully your servlet container documentation will give more details - for example, the Tomcat 6.0 documentation includes this page which gives details about exactly where Tomcat looks for classes.
You should also make sure that your class includes a package statement. I don't believe that Tomcat looks kindly on classes in the default no-package.
精彩评论