File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiling servlet?" Watch "compiling servlet?" New topic
Author

compiling servlet?

Kazi Siddiqui
Greenhorn

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\WebControl.java

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
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

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


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

Joined: Feb 22, 2009
Posts: 192
change

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

to

"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
Greenhorn

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 AcceptData.do 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: http://aspose.com/file-tools
 
subject: compiling servlet?