0

I'm trying to run the unit tests for zxing. I'm running

ant test-blackbox

This fails, however, with the output:

Buildfile: c:\Workspace\zxing-2.1\core\build.xml

init:

build:

build-test:
    [javac] Compiling 109 source files to c:\Workspace\zxing-2.1\core\build-test
    [javac] c:\Workspace\zxing-2.1\core\test\src\com\google\zxing\client\result\URIParsedResultTestCase.java:73: error: unmappable character for encoding Cp1252
    [javac]                  "\u0013\u0013¬æZ{√π√é√ù√ö¬óZ¬ß¬®+y_zb√±k\u00117¬�\u000E¬Ü√ú\u0000\u0000\u0000\u0000" +
    [javac]                                                                                            ^
    [javac] 1 error

BUILD FAILED
c:\Workspace\zxing-2.1\core\build.xml:54: Compile failed; see the compiler error output for details.

Total time: 0 seconds
sashoalm
  • 75,001
  • 122
  • 434
  • 781

2 Answers2

2

Turns out the error was because the files are encoded using UTF-8, but the compiler uses Windows default encoding. I fixed the error by defining a new environment variable - JAVA_TOOL_OPTIONS, and setting it to -Dfile.encoding=UTF8, as outlined in https://stackoverflow.com/a/623036/492336

Community
  • 1
  • 1
sashoalm
  • 75,001
  • 122
  • 434
  • 781
1

Forget about generating core.jar yourself it is a big headache

Just download latest library from:https://github.com/zxing/zxing

and download readymade jar of any version you want from here: http://repo1.maven.org/maven2/com/google/zxing/

That's all.

UMAR-MOBITSOLUTIONS
  • 77,236
  • 95
  • 209
  • 278