This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to start with servlets do i need to install j2ee jdk just like i had j2se jdk on my pc ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to start with servlets do i need to install j2ee jdk just like i had j2se jdk on my pc ?
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If am not mistake, you will need the j2se and tomcat. [=
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert Coelho wrote:If am not mistake, you will need the j2se and tomcat. [=

i have that
but still the code which has import like
javax.servlet...
is not compilling and message is
this package does not exits even though i have manually seen the api there is no such package called javax.servlet in standard j2se
where as this is the same problem in netbeans while creating j2se apps you will not see any package like javax.servlet and while creating
web application in netbeans we can use javax.servlet ?
so thats why i wanted to know , do i need j2ee sdk to complile servlet code or j2se is enough ?
 
Tim Moores
Bartender
Posts: 3131
50
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That package is not part of JSE, but it comes with Tomcat; look in the TOMCAT_HOME/lib directory for a file called servlet-api.jar. You need to include that in all classpaths you intend to use with servlets.
 
Joe Ess
Bartender
Posts: 9338
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat includes an implementation the Servlet API from the Java EE. You need to include the servlet API JAR file from Tomcat in your classpath to resolve classes in the javax.servlet package.
See the Tomcat Application Developer's Guide for some helpful information on coding for Tomcat.
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:That package is not part of JSE, but it comes with Tomcat; look in the TOMCAT_HOME/lib directory for a file called servlet-api.jar. You need to include that in all classpaths you intend to use with servlets.

when ever i use to set the class path
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to enclose the entire class path, as well as the file path, in double quotes:
C:\Users\Admin>javac -classpath "C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar;" "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\beerV1\src\com\example\web\BeerSelect.java". If you don't then the command prompt will see the spaces as separators for different arguments. The arguments to javac then become:
* -classpath
* C:\Program
* Files\Apache
* Software
* Foundation\Tomcat 6.0\lib\servlet-api.jar;
* C:\Program
* Files\Apache
* Software
* Foundation\Tomcat 6.0\webapps\beerV1\src\com\example\web\BeerSelect.java

The quotes will cause everything between them to be seen as one single argument:
* -classpath
* C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar;
* C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\beerV1\src\com\example\web\BeerSelect.java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic