Patrick Kobly wrote:
Add the servlet API JAR to the classpath (with -cp or CLASSPATH env variable). Or use Maven to build your projects and define the dependencies appropriately.
When I run "javac HelloWorld.java" I get a number of errors like HelloWorld.java:12: error: cannot find symbol public class HelloWorld extends HttpServlet {
I see that this class is in /usr/share/java/tomcat-servlet-api.jar and if I expand this jar file in the current directory then the compilation succeeds. But it is not sufficient to copy the jar file to the current directory (or to put a link to it in /usr/lib/java/ .)>
Add the servlet API JAR to the classpath (with -cp or CLASSPATH env variable). Or use Maven to build your projects and define the dependencies appropriately.
Thanks very much, export CLASSPATH=$CLASSPATH:/usr/share/java/tomcat-servlet-api.jar did the trick. I was assuming (rather stupidly) that it was sufficient to put the directory into the classpath.
.