• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Bartender
Posts: 7520
172
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22755
130
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
permaculture is giving a gift to your future self. After reading this tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic