• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

import javax.GenericServlets not found

 
tushar attar
Ranch Hand
Posts: 37
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?
 
Tim Moores
Bartender
Posts: 3139
50
  • 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: 37
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
Bartender
Posts: 3139
50
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic