Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1113507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:52:11+00:00 2026-05-17T02:52:11+00:00

Looked at several post on stackoverflow as well as other sources (online + ANT

  • 0

Looked at several post on stackoverflow as well as other sources (online + ANT definition guide book) but none of them helped so far. I can’t exclude the file from compiling.

I have just one file that wants to exclude from compiling and ANT documentation is not really telling the detail.
I’m trying to exclude HTMLParser.java from compiling.
Also tried using excludesfile too. But it still complies HTMLParser.java

I wrote simple ANT to examine trying different variation below.

Could anyone tell me what’s wrong?

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
      <excludesfile name="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities\HTMLParser.java" />
</javac>

<project 
     name="CompileMasatosan"  
     default="main"
     basedir="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan">

     <property name="dest"
    location="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\WEB-INF\classes" />


     <property name="utilitiesSrc" 
        location="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities" />

    <javac srcdir="${utilitiesSrc}" destdir="${dest}">
         <exclude name="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities\HTMLParser.java" />
    </javac>
</project>

The HTMLParser.java I believe has no dependency since I commented all lines out except class declaration line.

HTMLParser.java

package com.masatosan.utilities;

public class HTMLParser {
/*  commenting out since Eclipse doesn't like some characters :(

    public static final String escapeHTML(String s){
           StringBuffer sb = new StringBuffer();
           int n = s.length();
           for (int i = 0; i < n; i++) {
              char c = s.charAt(i);
              switch (c) {
                 case '<': sb.append("&lt;"); break;
                 case '>': sb.append("&gt;"); break;
                 case '&': sb.append("&amp;"); break;
                 case '"': sb.append("&quot;"); break;
                 case 'à': sb.append("&agrave;");break;
                 case 'À': sb.append("&Agrave;");break;
                 case 'â': sb.append("&acirc;");break;
                 case 'Â': sb.append("&Acirc;");break;
                 case 'ä': sb.append("&auml;");break;
                 case 'Ä': sb.append("&Auml;");break;
                 case 'Ã¥': sb.append("&aring;");break;
                 case 'Ã…': sb.append("&Aring;");break;
                 case 'æ': sb.append("&aelig;");break;
                 case 'Æ': sb.append("&AElig;");break;
                 case 'ç': sb.append("&ccedil;");break;
                 case 'Ç': sb.append("&Ccedil;");break;
                 case 'é': sb.append("&eacute;");break;
                 case 'É': sb.append("&Eacute;");break;
                 case 'è': sb.append("&egrave;");break;
                 case 'È': sb.append("&Egrave;");break;
                 case 'ê': sb.append("&ecirc;");break;
                 case 'Ê': sb.append("&Ecirc;");break;
                 case 'ë': sb.append("&euml;");break;
                 case 'Ë': sb.append("&Euml;");break;
                 case 'ï': sb.append("&iuml;");break;
                 case '�': sb.append("&Iuml;");break;
                 case 'ô': sb.append("&ocirc;");break;
                 case 'Ô': sb.append("&Ocirc;");break;
                 case 'ö': sb.append("&ouml;");break;
                 case 'Ö': sb.append("&Ouml;");break;
                 case 'ø': sb.append("&oslash;");break;
                 case 'Ø': sb.append("&Oslash;");break;
                 case 'ß': sb.append("&szlig;");break;
                 case 'ù': sb.append("&ugrave;");break;
                 case 'Ù': sb.append("&Ugrave;");break;         
                 case 'û': sb.append("&ucirc;");break;         
                 case 'Û': sb.append("&Ucirc;");break;
                 case 'ü': sb.append("&uuml;");break;
                 case 'Ü': sb.append("&Uuml;");break;
                 case '®': sb.append("&reg;");break;         
                 case '©': sb.append("&copy;");break;   
                 case '€': sb.append("&euro;"); break;
                 // be carefull with this one (non-breaking whitee space)
                 case ' ': sb.append("&nbsp;");break;         

                 default:  sb.append(c); break;
              }
           }
           return sb.toString();
    }
    */
}//

UPDATE

As suggested in the comment, I change the excludesfile name attribute to relative path of srcdir and that was it! So the snipped looks like:

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
      <excludesfile name="HTMLParser.java" />
</javac>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:52:12+00:00Added an answer on May 17, 2026 at 2:52 am

    Obvious thing I imagine you have already checked is that nothing that you are compiling has a dependency in HTMLParser. If this is the case, the javac command will compile the file anyways.

    To clarify, the problem above was using an absolute path with the exclude property. When a srcdir is given, ant creates an implicit path with exclude file names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've looked through several posts on StackOverflow, but haven't been able to find an
I have looked at several possible solutions to my issue but did not find
Well I've looked up several methods to fix this in my Windows Phone 7
I've looked at several URL rewriters for ASP.Net and IIS and was wondering what
I looked at the AdaCore site, as well as for A# (which now appears
I looked at SQL Server dateformat codes but I couldn't find dd.mm.yyyy hh:mm format
I looked in Stevens , and in the Posix Programmer's Guide , and the
Has anyone looked at Yahoo's ASTRA ? It's fairly nifty, but I had some
I've looked for some other articles on this problem and even tried some of
I just read this post about why new-line warnings exist, but to be honest

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.