Results 1 to 3 of 3
  1. #1
    Lukas is offline Member
    Join Date
    Aug 2009
    Rep Power

    Default Compile Servlets with Apache ANT


    I have a problem with Apache Ant. I write a Servlet and now i want to compile it but I always get a cannot find symbol!
    If i compile a normal Java Project everything goes right but not with the Servlet!? Does anybody knows if i have to do something else between compiling a Servlet or JAva Project? (build.xml?):confused:


  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    Can you show us the code around where you're getting that error?

  3. #3
    Lukas is offline Member
    Join Date
    Aug 2009
    Rep Power


    This is the code of my build.xml:

    Java Code:
    <project name="MyTask" basedir="." default="Main">
    	<property name="src" location="src" />
    	<property name="build" location="build" />
    	<property name="dist" location="dist" />
    	<property name="docs" location="docs" />
    	<property name="tomcat.home" location="C:\xampp\tomcat" />
    	<target name="clean">
    		<delete dir="${build}" />
    		<delete dir="${docs}" />
    		<delete dir="${dist}" />
    	<target name="makedir">
    		<mkdir dir="${build}" />
    		<mkdir dir="${docs}" />
    		<mkdir dir="${dist}" />
    	<target name="compile" depends="clean, makedir">
    		        <fileset dir="${tomcat.home}\lib" includes="*.jar" />
    		<javac srcdir="${src}" destdir="${build}" />
    	<target name="jar" depends="compile">
    		<jar destfile="${dist}\test.jar" basedir="${build}">
    				<attribute name="Main-Class" value="main.Main" />
    	<target name="Main" depends="compile, jar">
    		<description>Main target</description>
    The problem with the cannot find symbol is already solved! I forgot to set the classpath to my tomcat\lib!
    But after I did this I get another error now he tells me that:

    Problem: failed to create task or type classpath
    Cause: The name is undefined.
    Action: Check the spelling.
    Action: Check that any custom tasks/types have been declared.
    Action: Check that any <presetdef>/<macrodef> declarations have taken place.

    Does this mean he can not resolve <classpath>? Because when I type it he doesn't give me any suggestions for classpath....:confused:


Similar Threads

  1. Replies: 5
    Last Post: 11-20-2011, 10:22 PM
  2. org.apache.jasper.JasperException: Unable to compile class for JSP
    By satya kishore in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-13-2010, 02:40 PM
  3. Servlets
    By javahelp00 in forum New To Java
    Replies: 1
    Last Post: 02-28-2009, 07:28 PM
  4. Replies: 0
    Last Post: 11-15-2008, 08:29 AM
  5. Servlets
    By nagaroopanandha in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 02:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts