• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol  RSS feed

 
Killer Gaurav
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two java files here: D:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\MyApp\WEB-INF\classes\com\example\web
First: Dog.java
Second: Login.java

I am trying to compile from classes directory using the command:
D:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\MyApp\WEB-INF\cla
sses>javac -classpath "D:\Program Files\Apache Software Foundation\Tomcat 8.0\li
b\servlet-api.jar" com/example/web/Dog.java


[This one gets compiled without any problem]

For the other file:

D:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\MyApp\WEB-INF\cla
sses>javac -classpath "D:\Program Files\Apache Software Foundation\Tomcat 8.0\li
b\servlet-api.jar" com/example/web/Login.java

com\example\web\Login.java:39: error: cannot find symbol
Dog dog = (Dog) getServletContext().getAttribute("dog");
^
symbol: class Dog
location: class Login
com\example\web\Login.java:39: error: cannot find symbol
Dog dog = (Dog) getServletContext().getAttribute("dog");
^
symbol: class Dog
location: class Login
2 errors

Both the files are in the same directory.

Dog.java


Login.java

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!