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...
Similar Messages
-
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. -
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.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 -
Error in compiling: file javax\servlet\jsp\PageContext.class not found
Hi,
i'm getting an error when I'm trying to compile an java file. The error is as follows:
cannot access javax.servlet.jsp.PageContext
file javax\servlet\jsp\PageContext.class not found
Isn't the javax package included in jdk? I've installed jdk 1.3.1_03 and j2re1.4.0_02. Shouldn't this PageContext.class be automatically loaded when i've installed jdk?
I'm getting desperated! I've tried almost everything: i've changed the classpath, moved the directory of the java file I'm trying to compile over and over but i'm getting no success!
Any help is very welcome!
Thankx,
Nuno.hmmm... i had a look and it seems that what you are trying to "import" is actually in a package... instead of import try:
package javax.servlet.jsp;you may need to go download this "package" and complile it in the directory you are working in.
my advice: try the above statement (which does compile for me), if it doesn't work, you will need to find the source code for this package and compile it just like you do any other source code.
hope this helps. -
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. -
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 -
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 :) -
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 exist - settings appear to be correct
laugh as I write this post...it's hardly a "new topic."...but everything seems set just as it should be...
Okay...I'm a seasoned programmer in every language but JAVA. Here's the issue...every time I try to use the Core Servlets book/website by Marty Hall and Larry Brown I get hung up on the packages. This time, I downloaded and followed step by step what the website said to do...it was even preconfigured for me! Alas...I am getting the following compliation errors on a "simple packagless" program with NetBeans:
Compiling 1 source file to C:\Servlets+JSP\HelloServlet\build\classes
C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:2: package javax.servlet does not exist
import javax.servlet.*;
C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:13: cannot find symbol
symbol: class HttpServlet
public class HelloServlet extends HttpServlet {
C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:14: cannot find symbol
symbol : class HttpServletRequest
location: class HelloServlet
public void doGet(HttpServletRequest request,
C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:15: cannot find symbol
symbol : class HttpServletResponse
location: class HelloServlet
HttpServletResponse response)
C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:16: cannot find symbol
symbol : class ServletException
location: class HelloServlet
throws ServletException, IOException {
6 errors
BUILD FAILED (total time: 0 seconds)
These are my environment settings (note that the JAVAX package is located under the src folder in Java)
Catalina Home:
C:\apache-tomcat-6.0.10
CLASSPATH:
C:\apache-tomcat-6.0.10\lib\servlet-api.jar;
C:\apache-tomcat-6.0.10\lib\jsp-api.jar;
C:\apache-tomcat-6.0.10\lib\el-api.jar;
C:\Servlets+JSP;..;..\..;
C:\Program Files\Java\jdk1.6.0_03\src
JAVA_HOME
C:\Program Files\Java\jdk1.6.0_03
Path:
C:\Program Files\Java\jdk1.6.0_03\bin;%PATH%
Any ideas (excluding the one that maybe I should let my hair grow out, put on some tackey shorts and sandles and start palying an instrument in the streets of Austin for living?)cabkats wrote:
You are then suggesting that I make the corrections directly to the files in apache using notepad instead of using the envir. variables?No I am not suggesting that. I am suggesting that you need to read the documentation about the product(s) and set them up the way they require, rather than blindly think that the CLASSPATH environment variable is some magical entity.
I will try this, but I was hoping that since my IDE auto configured (with exception to java_home) that I would not have to do this. I wil give it try....thanks for the suggestion.See, you're using an IDE. Like I mentioned, IDEs do not use the CLASSPATH environment variable. You need to set up your project in your IDE in such a way that it knows what the dependent jars are. I'm sure there's a way to add jars to your project's dependencies. -
ATMTag.java:5: package javax.servlet does not exist
My j2ee jdk1.4.2 is not supporting javx package.
i already set all pathh and class path.
anybody can help me.
details are given below ::
C:\AVA\J2EE Programs\JSP\JSPCustomTag>javac ATMTag.java
ATMTag.java:5: package javax.servlet does not exist
import javax.servlet.*;
^<br>
ATMTag.java:6: package javax.servlet.http does not exist
<br>
import javax.servlet.http.*;
<br>
ATMTag.java:18: cannot resolve symbol
symbol : class TagSupport
location: class ATMTag
public class ATMTag extends TagSupport{
<br> ^
ATMTag.java:29: cannot resolve symbol
symbol : class JspTagException
location: class ATMTag
public int doStartTag() throws JspTagException{
<br> ^
ATMTag.java:31: cannot resolve symbol
symbol : class JspWriter
location: class ATMTag
<br> JspWriter out =pageContext.getOut();
^
ATMTag.java:31: cannot resolve symbol
symbol : variable pageContext
location: class ATMTag
<br> JspWriter out =pageContext.getOut();
^
ATMTag.java:56: cannot resolve symbol
symbol : variable pageContext
location: class ATMTag
pageContext.getOut().write(str);
<br> ^
ATMTag.java:60: cannot resolve symbol
symbol : variable EVAL_PAGE
location: class ATMTag
return EVAL_PAGE;
^
8 errorsWhen compiling servlets etc, you need to include in your classpath a jar file with all the javax.* classes defined in it.
For Tomcat this is called servlet.jar and is in (I think) [TOMCAT_HOME]/shared/lib or /common/lib
For J2EE 1.4 Server, the jar is [J2EE_HOME]/lib/j2ee.jar
Where the _HOME directory is the directory where you installed J2EE.
Include this jar file in your classpath when compiling.
Good luck,
evnafets -
Package javax.servlet.jsp does not exist.
dear all!
I've one program which import javax.servlet.jsp.* as one of the package to be used in
the program, and I am using j2sdk 1.4.0_01 to compiled it.
However I got this error message : package javax.servlet.jsp does not exist.
Where does it wrong?.
error message like :
logisticslib.java:6: package javax.servlet.jsp does not exist
import javax.servlet.jsp.*;
^
logisticslib.java:201: cannot resolve symbol
symbol : class JspWriter
location: class elogistic.db.logisticslib
public void getServiceInfo(JspWriter out, String SQL) {You need a J2EE implementation, I recomemend Tomcat, you also need to put the .jar w/ the implementation in in your classpath.
Maybe you are looking for
-
FlashHelp deployed in RH7 displays 404 page error instead of topic
I upgraded some help projects from RHX5 to RH7. In MAC (OS 10.5.x) Safari (3.2.1), when the application calls the FlashHelp authored in RH7, the Help opens, but the Help topic does not display. Instead, a 404 Page not found error is displayed. If you
-
Color consistency from Photoshop to AI?
I created a new logo recently. All the text was created in Illustrator and one element (radio antenna waves) was built in Photoshop. I've set the color to PMS 464 but when I bring the 'waves' into AI, the color is darker. I've tried adjusting diff
-
User exit today's date vs. last week
hi all, Can anyone send me the ABAP code to get the previous week data from today's date (user entry). I created a variable in qry but i need to write the user exit code. I'll assign points. thanks
-
I have a power pc G5 iMac, and I want to use some scripts to simplify my iTunes. I have read previous posts, and keep coming across instruction to check for a "scipts" folder in user>library>itunes>scripts I have two itunes files in library...... one
-
MapViewer 11g R1 (preview 1)
I've developed an Oracle maps application using 10.1.3 MapViewer Quick Start which includes functionality to plot FOI using the function createMarkerFOI(). The application uses it to plot several FOIs in a loop at the user request. This was working a