ANT Build Fail : package javax.servlet.jsp does not exist

11,154

Solution 1

Okie. I got the answer. It was problem in build file. This was the error

I had closed javac tag and then i was reading classpath. Anyway thanks a lot for your replies

Solution 2

it appears you have some jar files in the lib directory. Make sure that one of them has the package javax.servlet.jsp.

The problem here is that that package is usually supplied by whatever app server you are running on, so you typically don't need it in your war. But you do need it when you compile.

So you probably want to include libs from some other directory too, that has a jar that has that package, like javaee.jar

Solution 3

It seems like you're missing libraries that you're using in your project in the classpath. Try to set the classpath appropriately and point to your libraries (servlet-api.jar?).

Have a look at how to set a classpath.

Share:
11,154
freepublicview
Author by

freepublicview

Updated on June 04, 2022

Comments

  • freepublicview
    freepublicview almost 2 years

    I am trying to build a sample application using ANT build. But i am getting an exception :
    package javax.servlet.jsp does not exist. Here is my sample build.xml file. Application doesn't has any problem, but only in build there appears to be some problem. Please explain me whats the problem. I am new to ANT build.

                        <property name="build.dir" value="build"></property>
                        <property name="src.dir"  location="src"></property>
                        <property name="classes.dir" value="${build.dir}/classes"></property>
                        <property name="buildlib" location="WebContent/WEB-INF/lib"/>
    
                        <path id="build.classpath">
                              <fileset dir="${buildlib}" includes="*.jar"/>
                              <pathelement location="."/>
                            </path>
    
                        <target name="clean">
                            <delete dir="${build.dir}"/>
                        </target>
    
                        <target name="compile" depends="clean">
                            <mkdir dir="${classes.dir}"/>
                            <javac srcdir="${src.dir}" destdir="${classes.dir}"/>
                            <classpath refid="build.classpath" />
                        </target>
    
                    </project>
    
  • freepublicview
    freepublicview over 12 years
    Ya i am using lib directory and all jar files are placed inside it. But i didn't understand what is the solution to this problem. How can i rectify it?
  • freepublicview
    freepublicview over 12 years
    No the class path is fine. I echoed and checked.
  • freepublicview
    freepublicview over 12 years
    Okie. I got the answer. It was problem in build file. I had closed javac tag and then i was reading classpath. Anyway thanks a lot for your reply
  • freepublicview
    freepublicview over 12 years
    Soultion lies in build file.I had closed javac tag and then i was reading classpath.Anyway thanks a lot for your reply
  • Mubashar
    Mubashar over 10 years
    Thanks for clue, i was trying to uderstand why it is giving an error while this jar is a part of tomcat itself