Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maha please help - can't compile servlets!

 
eskay kumar
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks maha for ur prompt reply! I was unable to post this as a reply to the earlier post - was facing some problem of submitting the post. so i had to post a fresh one.
I did as u told me. But i still get the same error - package import javax.servlet not found when i try to compile a servlet.
I can't seem to figure out what is wrong so - I have listed down the exact settings when i enter a set command on my dos prompt. You might be able to tell me if I'm missing something
c:\>set
TMP=c:\WINDOWS|TEMP
TEMP=c:\WINDOWS|TEMP
PROMPT=$p$g
winbootdir=c:\WINDOWS
COMSPEC=c:\WINDOWS\COMMAND.COM
PATH=c:\windows;c:\windows\command;c:\oracle\bin;c:\orawin95;c:jdk1.2.2\bin;;c:\Progra~1\Networ~1\MCAFEE~1
classpath=;c:\jdk1.2.2\lib\tools.jar; c:\Progra~1\jswdk\lib\servlet.jar
windir=c:\windows
Though I have set the enviornment variables TOMCAT_HOME and JAVA_HOME they don't get listed in the above, do I have to set them again each time i restart my PC i.e.
c:> set TOMCAT_HOME=c:\Progra~1\tomcat
c:> set JAVA_HOME=c:\jdk1.2.2
Thanks
shilpa !
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

when they don't show up it means something is worng in
your auotexec.bat.
could you post more details so we could help.
regds.
- madhav
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shilpa,
I noticed one thing. First of all JAVA_HOME and TOMCAT_HOME are not set. It is very simple shilpa. Don't get frustrated. Remove all traces of jswdk related files from classpath. There is a servlet.jar file in c:\jakarta-tomcat\lib\servlet.jar dir. (assuming you have extracted the tomcat zip file in c:\ dir. When you unzip it automatically creates c:\jakarta-tomcat dir isn't? So put THIS c:\jakarta-tomcat\lin\servlet.jar in classpath. Do the exact procedure as Satya explaind here.
http://www.javaranch.com/ubb/Forum7/HTML/000598.html
Satya, Don't you think you have to add c:\jakarta-tomcat\lib\servlet.jar also in the 'set classpath...' line in autoexec.bat file if one wants to COMPILE SERVLETS also
So, Shilpa just add the c:\jakarta-tomcat\lib\servlet.jar also in the classpath with satya's procedure.
If possible you post your c:\autoexec.bat file also. We will find the culprit line
regds
maha anna
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satya, Don't you think you have to add
c:\jakarta-tomcat\lib\servlet.jar also in the 'set classpath...'
line in autoexec.bat file if one wants to COMPILE SERVLETS also


In my case, I din't add it to the class path. Also one thing
I observed abt tomcat is it does some elaborate stuff to set
the classpath as it wants it to be. So I am guessing that if
we don't set it correctly, it does it for us, except the jdk
portion of the class path, which is a pre-requisite to running
tomcat. Hence IMHO, if we set our jdk portion of the class path
correctly, tomcat automatically adds all the dependency jar reqd
for tomcat to run.
Regds.
- satya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic