Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 2nd, 2002, 09:36 PM
bradclark1 bradclark1 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: Connecticut, US
Posts: 8 bradclark1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Won't Compile Servlet

I've have tried for days to figure this out, and I know its something stupid, but when I try to compile:

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

public class HelloWorld extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

res.setContentType("text/html");
PrintWriter out = response.getWriter();

out.println("<html>");
out.println("<head><title>Hello World</title></head>");
out.println("<body>");
out.println("<big>Hello World!</big>");
out.println("</body></html>");
}
}

I get:
C:\JSrc\HelloWorld.java:5: cannot resolve symbol
symbol : class HttpServlet
location: class HelloWorld
public class HelloWorld extends HttpServlet {

I have this setup:
SET PATH=C;\WINDOWS;C:\WINDOWS\COMMAND;C:\jdk1.3.1\bin
set JAVA_HOME=C:\jdk1.3.1
set CLASSPATH=C:\jdk1.3.1\lib;C:\Tomcat4\common\lib\servlet.jar
set CATALINA_HOME=c:\Tomcat4

I get the Servlet.Jar in my path.
C:\WINDOWS>echo %classpath%
C:\jdk1.3.1\lib;C:\Tomcat4\common\lib\servlet.jar

Can someone please kick my head in the right direction?

Thanks in advance,

Brad

Reply With Quote
  #2  
Old April 2nd, 2002, 10:09 PM
ptinney ptinney is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Modesto, CA US
Posts: 1 ptinney User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to ptinney
This isn't the proper way, but try finding where j2ee.jar is on your computer and put it in the classpath. If you don't have it just grab the J2EE SDK off the Java site.

Reply With Quote
  #3  
Old April 2nd, 2002, 10:22 PM
aabha aabha is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: India
Posts: 7 aabha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to aabha
Eveything is fine with the pgm....u just have to import javax.servlet.http.*;
Thats were u can find HttpServlet class file....

Reply With Quote
  #4  
Old April 2nd, 2002, 10:26 PM
bradclark1 bradclark1 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: Connecticut, US
Posts: 8 bradclark1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Never mind (duh)

I went ahead and kicked myself in the head.

Line3 had just "servlet.*;" instead of "servlet.http.*;"

on " res.setContentType("text/html"); " the book just had res, but to make it work I had to add the whole word "response".

I also just put the servlet.jar the jre ext folder, which I'm not sure that really mattered though because I had it in my path supposedly.

Three days to figure that out, believe it or not. Live and learn

Brad

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Won't Compile Servlet

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap