• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting a servlet file to compile

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im just starting out on servlets. Downloaded the j2ee sdk5 from the sun website and installed it. Wrote the first program from the K&B book and when i tried to compile it using javac it throws me 5 errors saying
package javax.servlet, HttpServletRequest,HttpServletResponse not found. What could be wrong.

I tried setting the class path all over again. still no use. other j2se files compile fine and i have a problem only with this file

What do i do?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to include either j2ee.jar or servlets.jar on your classpath.

the JEE jar contains all of the required classes including servlets and ejbs, servlets just has the servlet and JSP stuff.
 
sudhan Sadanand
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya thanks... ran a search on that and found out how to get it done. Finally the code compiled n ran properly...
But is there an easier way out of this. I mean,can the .jar file be permanently included in the path rather than us having to type it manually everytime?
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes! In windows enviornment you can copy the .jar file location directly to the CLASSPATH system variable so that you dont need to include them again and again.

YOu need to

goto control panel->system->select advanced Tab under this you will find 2 buttons at bottom side of the dialog click on enviornment variables->select the CLASSPATH varible from system varibles list if it is not there then create one and insert the location of the .jar file, now its done!
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why not using some IDE like eclipse.....it will make the life simpler.....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ajse roy:
why not using some IDE like eclipse.....it will make the life simpler.....



That's debatable. For a beginner I usually recommend not using an IDE, because they require the user to understand a lot of things that won't make sense to beginners.
 
reply
    Bookmark Topic Watch Topic
  • New Topic