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

  • SEARCH
  • Home
  • 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 8516459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:26:03+00:00 2026-06-11T05:26:03+00:00

In my build.xml file I fetch some Java files by cxf. Some of these

  • 0

In my build.xml file I fetch some Java files by cxf. Some of these Java files need to be encoded in UTF-8. How can I use Ant to change the encoding to UTF-8?

PS: I found instructions for how to set the encoding for javac to UTF-8, but prior to javac I need Java files to be in UTF-8. Otherwise I get an error:

warning: unmappable character for encoding utf-8

Here is my code:

<macrodef name="lpwservice">
    <attribute name="name"/>
    <attribute name="package"/>
    <sequential>
        <property name="wsdlfile" value="${portal.basedir}/lpw/wsdl/@{name}.wsdl"/>

        <mkdir dir="${portal.basedir}/lpw/wsdl"/>
        <get src="${lpw.baseuri.cxf}/@{name}?wsdl" dest="${portal.basedir}/lpw/wsdl/@{name}.wsdl.new"/>
        <if>
            <and>
                <filesmatch file1="${portal.basedir}/lpw/wsdl/@{name}.wsdl" file2="${portal.basedir}/lpw/wsdl/@{name}.wsdl.new"/>
                <uptodate targetfile="${portal.basedir}/lpw-wsdl.jar" srcfile="${portal.basedir}/lpw/wsdl/@{name}.wsdl"/>
            </and>
            <then>
                <echo message="${wsdlfile} is up to date" level="info"/>
                <delete file="${portal.basedir}/lpw/wsdl/@{name}.wsdl.new"/>
            </then>
            <else>
                <echo message="${portal.basedir}/lpw/wsdl/@{name}.wsdl needs update" level="info"/>
                <move file="${portal.basedir}/lpw/wsdl/@{name}.wsdl.new" tofile="${portal.basedir}/lpw/wsdl/@{name}.wsdl" overwrite="true" />
                <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true" failonerror="true">
                    <arg value="-client"/>
                    <arg value="-d"/>
                    <arg value="${portal.basedir}/lpw/src"/>
                    <arg value="${portal.basedir}/lpw/wsdl/@{name}.wsdl"/>
                    <classpath>
                        <path refid="cxf.classpath"/>
                    </classpath>
                </java>
            </else>
        </if>
    </sequential>
</macrodef>

What should I do here to make

<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true" failonerror="true">

to encode java files in utf-8?

  • 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-06-11T05:26:05+00:00Added an answer on June 11, 2026 at 5:26 am

    Ant’s <copy> task has attributes encoding and outputencoding.

    Single Java File

    <copy file="myJavaFile.java" tofile="myJavaFile.java" overwrite="true"
        encoding="ISO-8859-1" outputencoding="UTF-8" />
    

    All Java Files in a Directory

    <property name="source.dir" location="/path/to/java/files" />
    
    <copy todir="${source.dir}" overwrite="true"
        encoding="ISO-8859-1" outputencoding="UTF-8">
      <fileset dir="${source.dir}" includes="*.java" />
    </copy>
    

    Simply change ISO-8859-1 to the encoding format of your Java files.

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

Sidebar

Related Questions

I've written an Ant build.xml file which obtains a number of source files via
We have a Java application and a supporting Ant build.xml file, and the team
i need to write an ant (build.xml) file to do the following: - run
So I wrote an ant build.xml file where I take the class files from
I am not able to build my application via Ant build.xml file when I
I need to build a huge XML file, about 1-50 MB. I thought that
I have a master build file which is calling other build.xml files of different
I have the following defined in a file called build-dependencies.xml <?xml version=1.0 encoding=UTF-8?> <project
Use 'ant clean test' with the newest android sdk got error: build.xml:622: The following
I need to build a XML file of my SQL table. This is my

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.