This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP : Cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP : Cannot find symbol" Watch "JSP : Cannot find symbol" New topic

JSP : Cannot find symbol

Harish V Gupta
Ranch Hand

Joined: Dec 17, 2011
Posts: 37
hi guys, I am trying to execute the servlet program for listener example give in Head First Book. I have placed all the java files (Dog, ListenerTester and MyServletContextListener) in the same path. Dog class is getting compiled successfully but the other two classes are showing the "Cannot find symbol(Dog)" error. Dog class is public but still it's not able to recognize it while compiling. I am compiling the file in CMD using the following command :
javac -classpath C:\apps\apache-tomcat-5.5.34\common\lib\servlet-api.jar -d classes "C:\Documents and Settings\372162\My Documents\J2EE_Practice\MyProjects\listener-Ex\src\com\example\web\"
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 378
Is your Dog in the classpath?
Harish V Gupta
Ranch Hand

Joined: Dec 17, 2011
Posts: 37
It's working now. I was not including the Dog.class's path in the classpath. It worked with the following command :
javac -classpath "C:\apps\apache-tomcat-5.5.34\common\lib\servlet-api.jar;C:\Documents and Settings\372162\My Documents\J2EE_Practice\MyProjects\listener-Ex\classes" -d classes "C:\Documents and Settings\372162\My Documents\J2EE_Practice\MyProjects\listener-Ex\src\com\example\web\"
I agree. Here's the link:
subject: JSP : Cannot find symbol
jQuery in Action, 3rd edition