• Post Reply Bookmark Topic Watch Topic
  • New Topic

cant find the javax package? any help?  RSS feed

 
Tom long
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I create a simple servlet and compile it from dos command. it show me that cannot find the javax.servlet package which I import it in the file?
I have installed the jdk1.3 and set the classpath with %JAVA_HOME%\lib.
what's wrong.
thank you.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.servlet is NOT part of the java Standard Development Kit.
you will have to get the java enterprise edition (J2EE) available @ http://java.sun.com/j2ee/download.html#sdk
the standard Servlet class is in javax.servlet.http.
have fun
dennis
 
Tom long
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get it !!
thank you.
 
Peter Gragert
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the cattledrive where servlets are part of the exercises. We use there the orion-web-server and it includes orion.jar including the /javax/... classes.
 
arif azim
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
Make sure servlet.jar is in your classpath and you should be all set.
For developing servlets, just make sure that the JAR file containing javax.servlet.* is in your CLASSPATH, and use your normal development tools (javac and so forth).
For running servlets, you need to set the CLASSPATH for your servlet engine. This varies from engine to engine. Each has different rules for how to set the CLASSPATH, which libraries and directories should be included, and which libraries and directories should be excluded.
Note: for engines that do dynamic loading of servlets (e.g. JRun, Apache Jserv, Tomcat), the directory containing your servlet class files should not be in your CLASSPATH, but should be set in a config file. Otherwise, the servlets may run, but they won't get dynamically reloaded.
The Servlets 2.2 spec says that the following should automatically be included by the container, so you shouldn't have to add them to your CLASSPATH manually.
classes in the webapp/WEB-INF/classes directory
JAR files in the webapp/WEB-INF/lib directory
Try this: Assume that you have servlet.jar file under
<jClass> location like: c:\jClass
at the command promt type:
set classpath=c:\jClass\lib\servlet.jar
thank you.
 
Doug Wang
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After upgrading to JDK1.4, you never need to care the sevlet package.
 
Tom long
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,Doug Wang
do you make sure the 1.4 jdk supports servlet?
the jdk vesion which i using is 1.4, I can find the supporting for servlet.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uhhh.... nope... Servlets weren't added into the 1.4 J2SE... you still have to download J2EE...

-Nate
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!