wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Basic doubt in compiling servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Basic doubt in compiling servlets" Watch "Basic doubt in compiling servlets" New topic

Basic doubt in compiling servlets

srinivas venkat

Joined: Aug 19, 2009
Posts: 8
I am studying head first java .In the starting pages of compiling a java file they gave command

%javac -classpath /your path/tomcat/common/lib/
servlet-api.jar -d classes src/Ch1Servlet.java

I could actually compile java file through editors but when i try to compile using command prompt i got %javac as not recognized command .if i remove % then i get

javac: invalid flag: Files\Apache
Usage: javac <options> <source files>
use -help for a list of possible options

i gave command as
javac -classpath C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar -d classes src\Ch1Servlet.java and i set the correct directory path also

Expecting a reply .
mark benz

Joined: Aug 18, 2009
Posts: 15
The problem seems to be caused by the white spaces you have in your class path to Tomcat.

Try enclose your path in double quotes.
srinivas venkat

Joined: Aug 19, 2009
Posts: 8
thank you very much that solved my problem
I agree. Here's the link: http://aspose.com/file-tools
subject: Basic doubt in compiling servlets