Hi friends, This is just a classpath question. Let me know if I should move it to some other forum.
how do we specify 2 or more classpaths? I am assuming it is using " : " !! am I wrong?
I am not able to compile the MyServletContextListener.java programs on page 171 in HF book.
I have following directory structure-
C:\MyProjects\beerV1\src\com\example\Dog.java and C:\MyProjects\beerV1\src\com\example\MyServletContextListener.java
and for storing class files I have
I could compile Dog.java without any problem. But when I try to compile MyServletContextListener.java I am getting lot of errors. For learning java, I have used Eclipse tool, so I am little weak when it comes to command line options for compiling and executing programs. MyServletContextListener.java had code something like this
I am using following command to compile MyServletContextListener
It gives 7 errors such as "could not find symbol- class ServletContextListener", "could not find symbol- class Dog"
Strange thing is if I give only C:\MyProjects>javac -classpath "C:\Program Files\apache tomcat\apache-tomcat-5.5.25\common\lib\servlet-api.jar" -d beerV1\classes beerV1\src\com\example\MyServletContextListener.java
I get only "could not find symbol- class Dog" error.
So may be I am using the -classpath option incorrectly? how do we specify 2 or more classpaths? I assumed it is using " : " !!
you have to use ; to seperate more than one classpath.... one more thing...you are just setting the path to servlet-api.jar file and what about your dog.class file. It is located some where in C drive and you are not setting that path.Include that path also.
Joined: Dec 03, 2007
Hey swapna ..thanks for the reply. I was using : to separate class paths because that's what I read in SCJP Study Guide by K And B