Package javax.servlet not found in sdk 1.4.0_01
Hi,
Please correct me if i'm wrong. I was using j2sdk 1.3.1 (standard edition) and have recently upgraded to j2sdk1.4.0_01. I can't find the javax.servlet package in the API. I referred to the j2ee sdk and found the package there. Does it mean that I need to have both the j2sdk1.4.0_01 and the j2sdkee1.3.1 (j2ee) in order to be able to compile and run my codes?
Thanks.
Karen
The servlet packages don't come with the standard SDK.
You can get them from javasoft.com or if you use the
Tomcat server they come packaged in a jar file called
servlet.jar
Similar Messages
-
Package javax.servlet not found error
package javax.servlet not found error. how it can be solved.
plz help this is my first servlet program.
vipinYou need a jar file that has in it the javax.servlet.* classes
It should be distributed with your servlet/jsp server.
It can normally be found in a /lib directory under the installation.
Some examples:
Tomcat4: install_dir\common\lib\servlet.jar
Tomcat5: install_dir\common\lib\servlet-api.jar; install_dir\common\lib\jsp-api.jar
J2sdkee: install_dir/lib/j2ee.jar
You need to include this jar file in your classpath when you compile any servlet. -
Compiling servlets - package javax.servlet not found
I can't seem to get the previous questions on this topic - get a page error. I've recently installed j2ee1.4 and j2sdk1.4.1_01 on Win98. I think I've set the CLASSPATH and PATH correctly (and JAVA_HOME). What have I missed?
servlet.jar in your classpath...
-
Package javax.mail not found in import.
hi,
i am trying to develop a mail application using jsp, i have jaf1.0.1 and javamail API and the application was working fine on weblogic but when i tried to do the same thing on Apache server the Package javax.mail not found in import. is occuring,
What could be the problem can any one explain...
ThanksI think you have not placed mail.jar and activation.jar files in the /jre/lib/ext directory. Just place the mail.jar and activation.jar files in the jdk's /jre/lib/ext directory and check out. This will work for you.
Rkanthj -
Package javax.swing not found in import!
I recently installed JDK 1.3.1_02 on WinNT4.0 and I cannot compile javax
packages without getting the following error:
Package javax.swing not found in import
I've tried every combination of modifying the CLASSPATH system variable
I can think of. I have no problem compiling java packages but not
javax packages. I followed the installation instructions to the letter.
What am I missing? Surely someone is running the same version of
the JDK I am on WinNT 4.0.Thanks again!!! I had an older version of javac running on my system any time I ran
outside of the bin where the latest javac was installed. I removed the older version
of the jdk and now I can compile from any directory. I really appreciate the help,
I was wracking my brain.
By the way, -version is not a valid flag for javac.exe, although it is for java.exe.
signed,
grateful in cyberspace -
Package javax.ejb not found error
Hi there,
I've downloaded j2se 1.4 and j2ee 1.3.1 and installed it on Windows XP. I set the environment variables as described. When I compile a .java file that imports the javax.ejb.* package, then I get an error "package javax.ejb not found". I feel like an idiot and I know it's something to do with the environment variables. (or just XP, most likely)
Thanks in advance
HoennerHow are you compiling your source? If you're using an IDE then you should edit your project classpath to include the j2ee.jar file (it'll probably be in the lib directory of your J2EE installation).
If you're doing it from the command line then type in SET CLASSPATH, look at the classpath it returns and check that it includes the j2ee.jar file.
Hope this helps. -
Javax.servlets not found
when i try to import the javax.servlet's, it is not found... any idea where i can go toget that? i downloaded the seperate elipse for J2EE and tried it on there, and i also tried it on the eclipse for regular java developers.
thanks
update: it turns out that eclipse has a # of requirements that it needs to get the WTP, i'll appreciate any assistance in directing me toward the files.
Edited by: ixxalnxxi on Jun 17, 2008 3:30 AMNo, you need to specify the application server in the eclipse project. Then it will take its libraries in the build path.
You may find this tutorial useful, you can just skip the JSF part if you aren't planning to use it: [http://balusc.blogspot.com/2008/01/jsf-tutorial-with-eclipse-and-tomcat.html]. -
Package javax.faces not found
Hi,
I tried to import the package javax.faces.* but it can not be resolved. Do I have to download this package myself? I'm using jre1.5.
Thanks!JSF isn't part of core Java. You need to download it separately, in a number of ways, and then include it in your compile-time classpath, and put it somewhere your container can get hold of it, too
-
Import javax.mail not found
Hello,
I am new to Java Mail. I wanted to test my first programme. When I compile, I get this errors.
package javax.mail not found in import and so on. I have set my classpath to so
set classpath = %classpath%;C:\j2sdk1.4.0\lib\mail.jar;C:\j2sdk1.4.0\lib\activation.jar
I included the mail.jar,smtp.jar and activation.jar in the lib directory of my jdk e.g c:\j2sdk1.4.0\lib\ "the jar file".
Can any one tell me what I am missing here?
Thanks
Jamesthe easiest way to do this is to put
activation.jar
mail.jar
mailapi.jar
imap.jar
smtp.jar
pop3.jar
into the virtual machine directory C:\Program Files\JavaSoft\JRE\1.3.1\lib\ext
or the lib\ext directory of whatever virtual machine you are using
and put coppies of them in JDK
C:\j2sdk1.4.0-beta3\jre\lib\ext
or jre\lib\ext
of whatever JDK you are using
this way they are found automaticaly
no need for classpath -
ANT script genrated error: package javax.servlet does not exist
Hi there,
I am running ANT and confronted this message:
[javac] Compiling 1 source file to C:\eclipseProjects\tomcat_test
[javac] C:\eclipseProjects\tomcat_test\WEB-INF\src\WebTest.java:4: package javax.servlet does not exist
[javac] import javax.servlet.ServletException;
[javac] ^I googled around and found this solution:
servlet-api.jar is the jarfile that contains javax.servlet.ServletException and javax.servlet.http.* which are imported by WebTest.java and must therefore be found in the classpath. If javac doesn't find this jar (or the javax.servlet packages), it will say (or shout, depending on my and javac's mood): [the error message]
well...I set in the classpath the location of the servlet-api.jar
(found at: C:\Tomcat\common\lib)
I set it with the environment variable (windows xp)
Just as it's shown here: http://www.cs.usask.ca/~wew036/latex/env-env.jpg
NOTHING :-(
could anyone assist, thanksHi..seems u r new to J2ee.. dont worry its a very small problem:
Here is the solution.. yes u have to edit the environment variables:..
I am using J2EE sdk 1.4 and running on xp
This is the classpath setting:
C:\Sun\AppServer\lib\j2ee.jar;
This is the PATH setting
C:\Sun\AppServer\bin;
Good Luck :) -
Problem: package javax.servlet.jsp does not exist
I am a novice JSP programmer. My projects that use any javax.servlet classes are not seeing those at all. I am working with a group of folks using Java SE 1.5. (Note: I'm using Windows so the directory separator is "\")
What Used to work:
1. Nearly all my projects were working using Java version 1.6. These projects were developed as examples from Wrox and Apress books about JSP and Struts.
What has changed:
1. I un-installed the version 1.6 of JDK and JRE, as well as tomcat, netbeans, and all the associated libraries/jars.
2. I installed version 1.5 of JDK and JRE, as well as tomcat, netbeans, and all the associated libraries/jars.
3. I updated my JAVA_HOME, CATALINA_HOME, CLASSPATH, and PATH environmental variables. I made sure that the path to servlet-api.jar (in the tomcat common\lib) is included in the classpath.
What is wrong:
1. References to javax.servlet.* are not satisfied--they are flagged in the source code in NetBeans and I get compiler errors with any project containing those references. For example:
... package javax.servlet.jsp does not exist
import javax.servlet.jsp.*;
What I've found:
1. My CATALINA_HOME=C:\Java\Tomcat 5.5
2. My JAVA_HOME=C:\Java\jdk1.5.0_11
3. My CLASSPATH=.;C:\Program Files\QuickTime\QTSystem\QTJava.zip;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib;%JAVA_HOME%\lib\jsp-api.jar;%CATALINA_HOME%\common\lib\servlet-api.jar;C:\Java\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar
4. My PATH=c:\wint\BIN;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;%CATALINA_HOME%\bin;C:\MySQL\MySQL Server 5.0\bin;D:\MiKTeX 2.5\miktex\bin;C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\SFU\Perl\bin\;C:\SFU\common\;C:\Program Files\Lahey-Fujitsu Fortran\v7.1\Bin;C:\Program Files\Lahey-Fujitsu Fortran\v7.1\Win32\Bin
What I need:
1. I need to have some reference to the servlet classes satisfied in my configuration. Any help is appreciated.
thanks
jondrOh. I got some over-the-shoulder debug help.
My error was in the classpath specification:
The path: %JAVA_HOME%\lib\jsp-api.jar
Should be: %CATALINA_HOME%\lib\jsp-api.jar
That contains the javax.servlet.jsp.*
Thimk.
Message was edited by: jon
jondr -
Error: package javax.servlet.http does not exist
Hi all,
How do I import javax.servlet?
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class BeerSelect extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWrite();
out.println ("Beer Selection Advide<br>");
String c = request.getParameter("color");
out.println ("<br>Got beer color " + c);
}What does this error mean? The error message:
Compiling 1 source file to C:\Program Files\Apache Software Foundation\MyProjects\J2EE\build\classes
C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:3:
package javax.servlet does not exist
import javax.servlet.*;
C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:4:
package javax.servlet.http does not exist
import javax.servlet.http.*;
C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:7:
cannot find symbol
symbol: class HttpServlet
public class BeerSelect extends HttpServlet {
C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:8:
cannot find symbol
symbol : class HttpServletRequest
location: class com.example.web.BeerSelect
public void doPost(HttpServletRequest request,
C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:9:
cannot find symbol
symbol : class HttpServletResponse
location: class com.example.web.BeerSelect
HttpServletResponse response)
C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:10:
cannot find symbol
symbol : class ServletException
location: class com.example.web.BeerSelect
throws IOException, ServletException {
6 errors
BUILD FAILED (total time: 0 seconds)Thank you.Hi,
The file servlet-api.jar / servlet.jar is not available in your classpath.
To compile an Servlet you need the jar file to be in classpath.
The jar file can be found in your webserver / application server lib folder.
Regards,
Zack -
Package javax.servlet does not exist, package javax.servlet.http does not
Dear All,
I am a newbie to JAVA.
I installed JDK1.6.0_04, then NetBeans IDE 6.0
I tried compiling an example servlet, but got this error message:
package javax.servlet does not exist, package javax.servlet.http does not exist
I tried locating these packages, but in vain. I also tried setting the CLASSPATH to many values, still it did not work.
Can anyone, please, help me with this.
Should I be able to see/locate these packages, do I have to download them?
Thank you very much.davidgoodman wrote:
Dear All,
I am a newbie to JAVA.
I installed JDK1.6.0_04, then NetBeans IDE 6.0
I tried compiling an example servlet, but got this error message:
package javax.servlet does not exist, package javax.servlet.http does not exist
What servlet/JSP engine do you plan to deploy to? Tomcat, perhaps?I think it's Tomcat (C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14). Are there other engines that come with NetBeans IDE 6.0 (when I downloaded NetBeans, I chose ALL)
>
If so, you'll need to put the servlet JAR in your CLASSPATH. (servlet-api.jar for Tomcat 5.5 and earlier, servlet.jar for 6.0 >and later.)
I tried locating these packages, but in vain.
You won't find them until you realize that you have to deploy that servlet someplace.How to deploy?
I also tried setting the CLASSPATH to many values, still it did not work.
See above. What were you planning to set CLASSPATH to?First I set to:
C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\lib (because I found jar named servlet-api.jar in this folder)
Later I added this:
C:\Program Files\Java\jdk1.6.0_04\lib (out of trial-and-fail)
Finally I added some paths that lead to a library such as
C:\Program Files\glassfish-v2\lib
C:\Program Files\glassfish-v2\lib\ant\lib
Can anyone, please, help me with this.
Should I be able to see/locate these packages, do I have to download them?
You have to get a servlet/JSP engine. Step 1.Thank you for your help -
Package javax.servlet does not exists - Cannot resolve symbol
Hello,
I am using JDK 1.3.1.06 version. I wanted to compile a simple servlet using this. But I am getting plenty of errors for all javax package. Why it is not able to find javax package classes?
The following is the program I have tried to compile.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class TestServlet extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
process(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
process(request, response);
private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
PrintWriter out = response.getWriter();
out.println("Hello World !");
I am getting errors like this :
Package javax.servlet does not exists.
cannot resolve symbol
symbol : class HttpServlet
Please advice me some solutions fast.
Thanking you,
ForumAns.javax.servlet doesn't come with the standard jdk. It's part of J2EE.
If you have tomcat, you can use the server.jar that comes with tomcat.
Or you can just download J2EE sdk instead.
I am getting errors like this :
Package javax.servlet does not exists.
cannot resolve symbol
symbol : class HttpServlet -
Package javax.servlet.http does not exist
Hello All,
A few problems here
1. My classpath doesnt seem to work.:
.;"C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar"
2. As a result, i get many errors in my simple code, but there are still a few that are not related to javac not recognizing the servlet api.
I also tried setting the classpath at the command line (event hough its temporary)
set classpath="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar"
but the servlet package is still not recognized
I have 2 classes, one to read the database connection details from a file and another class, my servlet.
Servlet Code:
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class CustomQuery extends HttpServlet
public void init() throws ServletException
EstablishDBConnetion.establishConnection();
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
response.setContentType("text/html");
PrintWriter printer = new response.getWriter();
String title = "Result from custom query";
Statement stmt = EstablishDBConnetion.establishConnection.con.createStatement();
ResultSet rs = stmt.executeQuery("select customerID from customer");
while(rs.next())
printer.println("<html> <head><title>" + title + "</title><br><br><table border=\"0\"> <tr><td>" + rs.getString(1));
rs.close();
stmt.close();
EstablishDBConnetion.establishConnection.con.close();
Database connection code
import java.io.*;
import java.sql.*;
import java.util.StringTokenizer;
class EstablishDBConnetion
public static void establishConnection()
try
String dbDriver = "";
String dbUrl = "";
String dbName = "";
String dbUser = "";
String dbPassword = "";
String newLine = "";
BufferedReader fileRead = new BufferedReader(new FileReader("connection.txt"));
boolean readerStatus = fileRead.ready();
newLine = fileRead.readLine();
while (readerStatus)
StringTokenizer st = new StringTokenizer(newLine, ",");
while (st.hasMoreTokens())
dbDriver = st.nextToken();
dbUrl = st.nextToken();
dbName = st.nextToken();
dbUser = st.nextToken();
dbPassword = st.nextToken();
readerStatus = fileRead.ready();
Class.forName(dbDriver);
String url = dbUrl + dbName;
System.out.print(url);
Connection con = DriverManager.getConnection(url, dbUser, dbPassword);
catch (IOException e)
System.out.println("IO exception in establishConnection()");
e.printStackTrace();
catch (java.lang.Exception ex)
System.out.println("General exception in establishConnection()");
ex.printStackTrace();
public static void main(String[] args)
//EstablishDBConnetion edbc = new EstablishDBConnetion();
establishConnection();
}also, full error list below
CustomQuery.java:4: package javax.servlet does not exist
import javax.servlet.*;
^
CustomQuery.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
CustomQuery.java:7: cannot find symbol
symbol: class HttpServlet
public class CustomQuery extends HttpServlet
^
CustomQuery.java:10: cannot find symbol
symbol : class ServletException
location: class CustomQuery
public void init() throws ServletException
^
CustomQuery.java:16: cannot find symbol
symbol : class HttpServletRequest
location: class CustomQuery
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
^
CustomQuery.java:16: cannot find symbol
symbol : class HttpServletResponse
location: class CustomQuery
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
^
CustomQuery.java:16: cannot find symbol
symbol : class ServletException
location: class CustomQuery
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
^
CustomQuery.java:19: package response does not exist
PrintWriter printer = new response.getWriter();
^
CustomQuery.java:24: cannot find symbol
symbol : variable establishConnection
location: class EstablishDBConnetion
Statement stmt = EstablishDBConnetion.establishConnection.con.createStatement();
^
CustomQuery.java:39: cannot find symbol
symbol : variable establishConnection
location: class EstablishDBConnetion
EstablishDBConnetion.establishConnection.con.close();
^
10 errors
I appreciate your help
Message was edited by:
paulchwd
null
Message was edited by:
paulchwdThe library is in tomcat/common/lib, not in tomcat/lib.
Maybe you are looking for
-
How can I delete photos from camera roll to give me more storage
I Upgraded to an iPhone 4 from a 3GS (mainly because it was a 99¢ promotion). I have only a little over 1GB-maybe less-left and it doesn't have music on it yet. I figured my photos are the answer but can't figure out how to delete them from the cam
-
Is it possible to add headers in acrobat standard cloud application?
Is it possible to add headers in acrobat standard cloud application?
-
Is it possible to download a QR code reader for the iPhone?
-
Hi All, I am facing an awkward problem. I created a Partner Profile for a Customer and assigned the Message Type 'DESADV' to it. Then I created a Delivery For the Customer corresponding to a created Sales Order . I put a break-point on the Corrsepond
-
Cannot access class javax.jms.TextMessage;
Hi, I am trying to run standard page from JDev and i am getting below error from EOImpl.java. " cannot access class javax.jms.TextMessage; file javax\jms\TextMessage.class not found " I tried to import javax/jms dir to my local machine but i could no