• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error showing in Servlet File.  RSS feed

 
Chandrasekhar Mangipudi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI. I have got one small problem.When compiling servlet class , i got this problem. Servlet and java .class files are in same folder named src. Both are compiled individually without errors.It happens when i instantiate Hello file in Ch1Servlet.

Compiling command are :

C:\apache-tomcat-6.0.14\webapps\ch1>javac -classpath C:\apache-tomcat-6.0.14\lib\servlet-api.jar src\Ch1Servlet.java

Ch1Servlet.java:9: cannot find symbol
symbol : class Hello
location: class Ch1Servlet
Hello he = new Hello();
^
Ch1Servlet.java:9: cannot find symbol
symbol : class Hello
location: class Ch1Servlet
Hello he = new Hello();
^
2 errors
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The classpath needs to point to the location of all class files that are needed for compilation, like this:

javac -classpath C:\apache-tomcat-6.0.14\webapps\ch1\WEB-INF\classes;C:\apache-tomcat-6.0.14\lib\servlet-api.jar src\Ch1Servlet.java
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!