Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling servlet

 
Ashish Modi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ashish Modi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am quite novice to JAVA, so could you be more elaborate please.

Thanks in advance.
 
Ashish Modi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, i figured out what you meant to say.
Thanks!:-)
 
Ashish Modi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Java In General (Beginner) where javac and classpath issues are discussed.
 
Ashish Modi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic