This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes to start with servlets do i need to install j2ee jdk just like i had j2se jdk on my pc ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "to start with servlets do i need to install j2ee jdk just like i had j2se jdk on my pc ? " Watch "to start with servlets do i need to install j2ee jdk just like i had j2se jdk on my pc ? " New topic
Author

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

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

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


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

If am not mistake, you will need the j2se and tomcat. [=


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Oct 29, 2001
Posts: 8914
    
    8

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

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

Joined: Oct 27, 2005
Posts: 19697
    
  20

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
GeeCON Prague 2014
 
subject: to start with servlets do i need to install j2ee jdk just like i had j2se jdk on my pc ?