File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes compiling servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiling servlet?" Watch "compiling servlet?" New topic

compiling servlet?

Kazi Siddiqui

Joined: Apr 12, 2009
Posts: 6
This is the first time I've tried to compile a servlet. I issued the following command from the project root directory: javac -classpath "e:\progra~1\apache~1\Apache Tomcat 6.0.18\lib\servlet-api.jar:classes:." -d classes .\src\com\paexample\web\

I got the following compilation errors:

I don't understand it. The path is holding the Java bin folder, and JAVA_HOME is set to C:\Program Files\Java\jdk1.6.0_13. Please help me compile this.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

Under Windows, classpath elements must be separated by the semi-colon character.

[Asking smart questions] [About Bear] [Books by Bear]
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192

"e:\progra~1\apache~1\Apache Tomcat 6.0.18\lib\servlet-api.jar:classes:."


"e:\progra~1\apache~1\Apache Tomcat 6.0.18\lib\servlet-api.jar"

and that will take care of the errors at line 4 and 5.


should be

and the same for HttpServletRequest and HttpServletResponse as well

Kazi Siddiqui

Joined: Apr 12, 2009
Posts: 6
Of course. It's right here in the book. Thanks, Ryan and Bear.

I'm trying to follow Head First Servlets & JSP's Mini MVC tutorial. However, I'm having lots of difficulty implementing it, though I suspect it's because of my own stupidity. For example, when I deployed the servlet, Tomcat refused to detect it, insisting that doesn't exist even though it's defined in web.xml. Upon restarting Tomcat, it now refuses to acknowledge the existence of the web application at all, even the html pages. When I tried to recompile the servlet with a Model class, javac says it cannot find the model package:

Putting the compiled model class into the classpath doesn't seem to work.

I not even sure where to start sorting out this mess.
I agree. Here's the link:
subject: compiling servlet?
It's not a secret anymore!