• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

compiling Servlet Example in HF Servlets & JSP

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to convert the servlet example in the first chapter of the Head First Servlets and JSP book. I have sucessfully installed Tomcat 5.0.30. My path variable is set to
"
D:\Sun\jwsdp-1.6\jwsdp-shared\bin;D:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\;D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Bin;D:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\;D:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin\prerelease;D:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin;D:\Qt\3.2.1NonCommercial\bin;D:\tomcat\bin;D:\tomcat\common\lib\servlet-api.jar"
I have tried setting the classpath in the environment variable instead of using the command line option, but nothing seems to work.
Has anyone ever had a similar experience or can anyone profer a solution?
Thanks in advance
 
Sheriff
Posts: 67553
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"kamfbd",

There aren't may rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One directory that appears to be missing is the current directory "."

You haven't told us why it isn't working, but omitting both the current directory and the directory starting your package means you code will never be found to be compiled.

... and welcome to the Ranch (please change your display name)

Dave
 
Fola Fadairo
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response,

First of all,here is the code

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class Ch1Servlet extends HtppServlet {

public void doGet(HtppServletRequest request, HtppServletResponse response ) throws IOException {
PrintWriter out = response.getWriter();
java.util.Date today = new java.util.Date();
out.println("<html>" + "<body>" + "<h1 align=center>HF\'s Chapter1 Servlet</h1>" +
"<br>" + today + "</body>" + "</html>" );
}
}

the problem lies within the import statements. I get the error messages,

cannot find symbol: symbol class HttpServlet

cannot find symbol: symbol class HttpServletRequest

cannot find symbol: symbol class HttpServletResponse

... my compilation command reads

c:\jspfiles\project1> javac -classpath c:\tomcat\common\lib\servlet-api.jar -d classes src\Ch1Servlet.java

I tried c:\jspfiles\project1> javac -classpath .;c:\tomcat\common\lib\servlet-api.jar -d classes src\Ch1Servlet.java

after reading your comments, but it changes nothing. I also tried c:\jspfiles\project1> javac -classpath .;c:\tomcat\common\lib\servlet-api.jar;c:\java\jdk1.5.0_05\lib\tools.jar -d classes src\Ch1Servlet.java

I still get 3 errors.

I would appreciate all help.
Thanks
Fola
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Fola", please read Bear's request more closely regarding the display name:

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

First name, a space, then you last name please.
 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So your code has "HtppServlet" and the error message says "HttpServlet"? Did you actually copy and paste the code and the error messages, or did you type it in? Because what's in your message can't be what's actually happening.
 
Fola Fadairo
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thx 4 ur all answers, located the problem after a whole weekend ... Http instead of Htpp :-(
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic