wood burning stoves 2.0*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiling servlet" Watch "compiling servlet" New topic
Author

compiling servlet

Ashish Modi
Greenhorn

Joined: Jun 11, 2007
Posts: 10
Hi,
Software installed - J2SDK1.4.2_14, TOMCAT 5.5
CLASSPATH - C:\j2sdk1.4.2_14\lib\j2ee.jar;C:\j2sdk1.4.2_14\lib; C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar
JAVA_HOME - C:\j2sdk1.4.2_14
TOMCAT_HOME - C:\Program Files\Apache Software Foundation\Tomcat 5.5

path for java file - F:\MyProjects\beer\src\com\example\web

command being used for compiling -
C:\j2sdk1.4.2_14\bin>javac -classpath c:\program~1\apache~1\tomcat5.5\common\lib
\servlet-api.jar:classes:. -d f:\myprojects\beer\classes\com\example\web f:\mypr
ojects\beer\src\com\example\web\BeerSelect.java
f:\myprojects\beer\src\com\example\web\BeerSelect.java:8: cannot resolve symbol
symbol : class HttpSerletRequest
location: class com.example.web.BeerSelect
public void doPost(HttpSerletRequest request, HttpServletResponse respon
se)
^
1 error

NOTE - i have searched the posts extensively and found many suggestions, but none could help, maybe this is an exceptional case ;-).
Could someone please rescue.
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Ashish Modi:
Hi,
Software installed - J2SDK1.4.2_14, TOMCAT 5.5
CLASSPATH - C:\j2sdk1.4.2_14\lib\j2ee.jar;C:\j2sdk1.4.2_14\lib; C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar
JAVA_HOME - C:\j2sdk1.4.2_14
TOMCAT_HOME - C:\Program Files\Apache Software Foundation\Tomcat 5.5

path for java file - F:\MyProjects\beer\src\com\example\web

command being used for compiling -
C:\j2sdk1.4.2_14\bin>javac -classpath c:\program~1\apache~1\tomcat5.5\common\lib
\servlet-api.jar:classes:. -d f:\myprojects\beer\classes\com\example\web f:\mypr
ojects\beer\src\com\example\web\BeerSelect.java
f:\myprojects\beer\src\com\example\web\BeerSelect.java:8: cannot resolve symbol
symbol : class HttpSerletRequest
location: class com.example.web.BeerSelect
public void doPost(HttpSerletRequest request, HttpServletResponse respon
se)
^
1 error

NOTE - i have searched the posts extensively and found many suggestions, but none could help, maybe this is an exceptional case ;-).
Could someone please rescue.


Not exceptional case but rather the most common programing error of all time. HttpServletRequest should do the trick
[ July 07, 2007: Message edited by: Mark Smyth ]

SCJP<br />SCJD
Ashish Modi
Greenhorn

Joined: Jun 11, 2007
Posts: 10
I am quite novice to JAVA, so could you be more elaborate please.

Thanks in advance.
Ashish Modi
Greenhorn

Joined: Jun 11, 2007
Posts: 10
sorry, i figured out what you meant to say.
Thanks!:-)
Ashish Modi
Greenhorn

Joined: Jun 11, 2007
Posts: 10
Head First Java, Ch 3, page - 85

While trying to compile the servlet code i get the following error
-



Can anyone please come to my rescue :-(

can someone please help

[ July 07, 2007: Message edited by: Ashish Modi ]

[KO: Added code tags for readability]
[ July 07, 2007: Message edited by: Katrina Owen ]
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1364
    
  17
First, I'd like to request that you use the CODE tags when you post code, so that the code remains formatted, and is easier to read.




The above error message is telling you that it can't figure out where you declared the variable called result. If you look closely at your code, you will see why the compiler is complaining.



The other complaints all relate to the same sort of thing: It can't find the class called BeerExpert. Have you compiled BeerExpert.java?
[ July 07, 2007: Message edited by: Katrina Owen ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Moving to Java In General (Beginner) where javac and classpath issues are discussed.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ashish Modi
Greenhorn

Joined: Jun 11, 2007
Posts: 10
First Off, thanks for guiding me to use the CODE tag while quoting any code snippet. It does make the questions more visible to anyone looking at it.

Following is how the errors got resolved:-

(a) The below error was resolved using the modified command for compilation.


(b)The subsequent two errors were resolved once the compiler could find the BeerExpert class.

(c)The last one as pointed out by Katrina was indeed a typo.


Thanks one and all for your support.
 
 
subject: compiling servlet