• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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: 5025
134
  • 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: 5025
134
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!