Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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 ?
 
Saloon Keeper
Posts: 7224
169
  • 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: 22563
122
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic