Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

import javax.GenericServlets not found  RSS feed

 
Ranch Hand
Posts: 43
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , I am using tomcat and have setup the classpath in PATH enviroment variable to the servlet-api.jar file. Whenever i compile my java servlet code i get import javax.GenericServlets not found . Though if I compile code using -classpath "path to servlet api" while compiling code it compiles successfully.

What i am doing wrong while setting up the PATH variable?
 
Saloon Keeper
Posts: 4689
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) PATH has nothing to do with the classpath. CLASSPATH does, though, although I don't recommend using it.

2) javax.GenericServlets is not a class, nor does the "javax" package actually have any classes in it. Or was that just a copy/paste error?
 
tushar attar
Ranch Hand
Posts: 43
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2) javax.GenericServlets is not a class, nor does the "javax" package actually have any classes in it. Or was that just a copy/paste error?


I am sorry that was typo error
import line is aactually import javax.servlet.*


PATH has nothing to do with the classpath. CLASSPATH does, though, although I don't recommend using it.


Then what is the solution?
 
Tim Moores
Saloon Keeper
Posts: 4689
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If compiling using - classpath works, I don't think anything needs to be done.

Since the number of external libraries in your projects is likely to increase over time (which makes typing in command line arguments tiresome), you may want to look into build tools like Ant, Maven and Gradle.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!