Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error compiling a servlet

 
mazoun yusuf
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I am getting an error message while compiling a servlet which is package java.servlet does not exist import javax.servlet*;
am using tomcat5.0 and j2sdk1.4-0..
i have set my path in the user variable as follow:
path c:\jdk\bin(i hav renamed the j2sdk)

and in the system variable i have defined:]
CATALINA_HOME C:\java\tomcat-5.0
CLASSPATH C:\CATALINA_HOME\common\lib\servlet-api.jar
JAVA_HOME C:\jdk

please help
xtremely urgent
 
Vijay Sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I think u have wriiten there javax.servlet*;
It should be javax.servlet.*;
That's why u are getting error for servlet package does not exist.Try this out,and then tell me.Is it ok...
 
gaurav chhabra
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
the above solution is correct but if it is not working then let me know
bye
gaurav
 
mazoun yusuf
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for replying gentleman

i have written the servlet right.i wanted to know if the path and classpath are correct?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's finding javac so your path is right.

It's not finding the servlet classes so either you haven't written the import statement correctly, as John suggested, or your classpath is not right.
 
mazoun yusuf
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. i have corrected the errors.however am still not being able to compile.what classpath should i use?

2. in what folder should i put the class files in my tomcat directory?

3. what changes do i have to make in the web.xml file?

(it should be noted that one class files calls for another one which inturn calls for another one)

thanks in aDVANCE
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Maz-dues"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic