Hi,
I am about to finish the book Head First
Java, I am at the last chapter. There's an example of how
servlets can be used to call methods on other classes, so I wrote the corresponding code provided in the book; the code for the servlet goes like this :
and code for the method that's being called goes like this :
I am using
Tomcat 8, my directory where I am keeping my classes is like this :
C:/Tomcat8/webapps
In webapps folder the structure of the folder where my class lands is like this
webbapps > PhraseOMatic
PhraseOMatic has two folders src and WEB-INF,
WEB-INF folder has the classes folder where the both the classes should land.
WEB-INF folder also has the XML file.
now when i compile the PhraseOMatic.java file, it compiles without any error and the class lands into the classes folder.
when I compile the KathyServlet.java the compiler shows the following error :
C:\Tomcat8\webapps\PhraseOMatic\src>javac -classpath ..\..\..\lib\servlet-api.jar -d ../WEB-INF/classes KathyServlet.java
KathyServlet.java:16: error: cannot find symbol
out.println("<P>" + PhraseOMatic.makePhrase());
^
symbol: variable PhraseOMatic
location: class KathyServlet
1 error
I have no Idea why am I getting this error. Why isn't it being able to call the method in PhraseOMatic class, any help will be greatly appreciated.
Thank You
Harsh Chandola