This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes How to compile the code on p171? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "How to compile the code on p171?" Watch "How to compile the code on p171?" New topic
Author

How to compile the code on p171?

prajal Mehta
Ranch Hand

Joined: Dec 03, 2007
Posts: 66
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

C:\MyProjects\beerV1\classes\com\example

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 " : " !!
swapna rao
Ranch Hand

Joined: Feb 12, 2008
Posts: 53
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.


SCJP-88<br />SCWCD-94
prajal Mehta
Ranch Hand

Joined: Dec 03, 2007
Posts: 66
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
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I was using : to separate class paths because that's what I read in SCJP Study Guide by K And B

Colons are used on Unix. You'll have to use semi-colons on Windows.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to compile the code on p171?
 
Similar Threads
Not able to import
Compiling custom imports
Problems compiling packages #2 with JSP
Hi, package compiling question...
HFSJ: Error while compiling servlet example