Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Need help w. the servlet.jar file.

Reply
Thread Tools

Need help w. the servlet.jar file.

 
 
Steve R. Burrus
Guest
Posts: n/a
 
      06-12-2004
Yes, I find myself in pretty immediate need for some help/assistance
with the servlet.jar file in a servlet! Now, I am mainly working with
the Tomcat application server, version 5.0.19. I know that this kind of
a file for this version of tomcat is called the "servlet-api.jar" file,
which I have in the proper place, in the "C:\tomcat 5.0\common\lib"
folder. But when I go to trying to compile a particular utilities class
that the servlet depends on, the "ServletUtilities.java" file, all that
I get is an error message saying that it is the wrong "symbol" or it's
missing or something like that! Can someone please help?

 
Reply With Quote
 
 
 
 
Sudsy
Guest
Posts: n/a
 
      06-12-2004
Steve R. Burrus wrote:
> Yes, I find myself in pretty immediate need for some help/assistance
> with the servlet.jar file in a servlet! Now, I am mainly working with
> the Tomcat application server, version 5.0.19. I know that this kind of
> a file for this version of tomcat is called the "servlet-api.jar" file,
> which I have in the proper place, in the "C:\tomcat 5.0\common\lib"
> folder. But when I go to trying to compile a particular utilities class
> that the servlet depends on, the "ServletUtilities.java" file, all that
> I get is an error message saying that it is the wrong "symbol" or it's
> missing or something like that! Can someone please help?


1st step in problem determination: review the EXACT messages being
generated. Using a phrase such as "something like that" will not
generally prompt people to reply.
So we need to see the following:
- your CLASSPATH
- the source
- the EXACT error message you get when you try to compile
Capture the console output to a file then cut-and-paste into a reply.

 
Reply With Quote
 
 
 
 
Steve R. Burrus
Guest
Posts: n/a
 
      06-13-2004
Sudsy wrote:
> 1st step in problem determination: review the EXACT messages being
> generated. Using a phrase such as "something like that" will not
> generally prompt people to reply.
> So we need to see the following:
> - the EXACT error message you get when you try to compile


Okay, "Sudsy", here is the exact error msg. which I haved been getting:
>>"C:\jakarta-tomcat-5.0.12\webapps\ROOT\WEB-INF\classes\coreservlets\HelloServlet3.java:23: cannot find symbol

symbol : variable ServletUtilities
location: class coreservlets.HelloServlet3
out.println(ServletUtilities.headWithTitle(title) + ^ 1 error
Tool completed with exit code 1"<<

> - the source


Okay, here is my source code :
>>"package coreservlets;


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

public class HelloServlet3 extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Hello (3)";
out.println(ServletUtilities.headWithTitle(title) +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1>" + title + "</H1>\n" +
"</BODY></HTML>");
}
}"<<

> - your CLASSPATH


And finally, going into my win xp Pro's System Settings, my classpath is

..;C:\jakarta-tomcat-5.0.12\common\lib\servlet-api.jar;C:\jakarta-tomcat-5.0.12\common\lib\jsp-api.jar;
C:\ServletDev;C:\j2sdk1.5.0\lib\tools.jar;C:\j2sdk ee1.3.1\lib\j2ee.jar *

* i of course have all of the classpath on just 1 line "in real life"

 
Reply With Quote
 
Sudsy
Guest
Posts: n/a
 
      06-13-2004
Steve R. Burrus wrote:
> Sudsy wrote:
>
>> 1st step in problem determination: review the EXACT messages being
>> generated. Using a phrase such as "something like that" will not
>> generally prompt people to reply.
>> So we need to see the following:
>> - the EXACT error message you get when you try to compile

>
>
> Okay, "Sudsy", here is the exact error msg. which I haved been getting:
> >>"C:\jakarta-tomcat-5.0.12\webapps\ROOT\WEB-INF\classes\coreservlets\HelloServlet3.java:23: cannot find symbol


So you naturally have a file in the directory
C:\jakarta-tomcat-5.0.12\webapps\ROOT\WEB-INF\classes\coreservlets
named ServletUtilities.java and which also has the
package coreservlets;
declaration, right? And you compiled in the coreservlets subdirectory
without the -d flag?
You still seem to be missing the fundamental concept that packages map
to the directory structure. A servlet container will automatically
include the WEB-INF/classes directory in the classpath. You just have
to make sure that your classes have the correct package declaration
and sit at the correct place in the directory heirarchy.

 
Reply With Quote
 
juli
Guest
Posts: n/a
 
      06-16-2004
hai steve,

step 1>If u have servlet.jar file in ur java bin directory ie copy & paste
servlet jar file from tomcat lib folder

step 2> compile ur java file using the below command
javac -classpath ./servlet.jar;./server.jar\bin <filename.java>

i think this should work now u can copy ur class file to ur tomcat class
directory.
IF ABOVE STEP DOES NOT WORK
or u can set a classpath in ur enviroment variable if ur using win xp or
me ie
set CLASSPATH= C:\TOMCATFOLDER\COMMON\LIB\SERVLET.JAR
THE U CAN COMPILE UR CLASS FILE

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help, I am intermediate in Java...need help in follow case ElementX Java 9 10-01-2008 08:02 PM
Help Help. I really need some help with this =?Utf-8?B?Q2hyaXM=?= ASP .Net 3 01-31-2007 09:33 PM
re_---need help Network Adapters!!!! NEED HELP!!!! hedayatniac@gmail.com Computer Support 4 08-13-2006 01:03 AM
Need help! I need to add lead zeros to a textbox Teep ASP .Net 2 06-21-2004 01:04 PM
Please help!!! Need datagrid selection to fill textboxes...Need quick!! TN Bella ASP .Net 1 06-18-2004 01:31 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57