This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes problem in servlet complation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem in servlet complation" Watch "problem in servlet complation" New topic
Author

problem in servlet complation

Himanshu Daurbi
Greenhorn

Joined: Nov 09, 2011
Posts: 4
Hi All,
I am using apache-tomcat server and I have already set classpath and Jdk path by environment variable. When I'm compiling my servlet as
C:>cd Users\him\applications\tomcat 5.5\webapps\myproject
c:>javac -classpath "Users\him\applications\tomcat 5.5\common\lib\servlet-api.jar";classes:. -d classes src\com\example\web\MyServlet.java

I am getting error like...

cannot find symbol
symbol : class HttpServlet


can anyone tell me what is the source of error.
thanks in advance........................................
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Can you show the relevant parts of your servlet? Like the import for HttpServlet?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi,
you should use any IDE for development like eclipse or netbeans still if you want to compile manually you can put that lib path in environmental variable of path for Window.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Miku Ranjan wrote:you can put that lib path in environmental variable of path for Window.

The correct place would be CLASSPATH, not PATH. I generally advise not to use CLASSPATH, it causes more problems than it fixes IMO.
Rajesh Grover
Greenhorn

Joined: Nov 11, 2011
Posts: 2
Hii.... You might be forgot to import javax.servlet.http;
Dwarka Damodaran
Greenhorn

Joined: Nov 10, 2011
Posts: 7
Hay Himanshu,

I am using apache-tomcat server and I have already set classpath and Jdk path by environment variable


If you have already set the classpath then why are you still refering it during compilation. Its better to remove it from environment variable or to remove it from your compilation command. (Here i am talking about the servlet-api.jar)

In general during these situations the best way to setup an environment is to use a .bat, .cmd or a .sh file and set everything in that rather than messing up with the environment variable. In that way you have better control over the current command prompt.

Hope this helps you.

Thanks and Regards,
Dwarka
Ajaybcamca Sharma
Greenhorn

Joined: Nov 11, 2011
Posts: 1
hey you should import javax.servlet first before compile the program
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in servlet complation
 
Similar Threads
Classpath in Command line
compiling servlet
JNDI problem
problem in compilation of servlet in apache-tomcat
problem in compiling servlet