Search code examples
utf-8antjavac

unsupported encoding: UTF-8


I have ant script that include a javac blocks for components:

<javac destdir="<component path>\bin"  source="1.7" target="1.7" encoding="UTF-8 " includeantruntime="false"> <!-- includes="**/*.java" -->
    <src path="<component path>\src"/>


    <classpath refid="classpath.base_componentName" />
</javac>

because we have in code some utf-8 languages (such as: Greek, Japanese, Chineee) text there was a need to use encoding="UTF-8" (instead of Cp1252).

When running this script getting this error:

error: unsupported encoding: UTF-8

I'm running the script with alias build that include the java version that I want to use:

export PATH="/c/Program Files/Apache Software Foundation/apache-ant-1.9.11/bin:/c/Program Files/Java/jre7/bin":$PATH

alias build="ant -f tools/build/ant-scripts/buildComponents.xml -Dproperties.file="buildAllWars.properties""

tried to use different java versions (1.7, 1.8) but didn't help!


Solution

  • You actually specify encoding="UTF-8 ". Note the trailing space. Remove that space, by changing it to encoding="UTF-8".