您好我必须使用javase
zxing模块。
我已阅读zxing getting start并尝试编译core
和javase模块(使用JDK 1.5.0_22)
我在核心文件夹中运行ant脚本,我有这个错误:
[javac] javac: invalid target release: 6
如果我修改核心文件夹中的ant脚本build.xml
,将target=6
替换为target=5
,将source=6
替换为source=5
,我有42个编译错误:
init:
build:
[javac] Compiling 169 source files to D:\ZXing-2.0\zxing-2.0\core\build
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatReader.j
ava:52: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatReader.j
ava:66: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatReader.j
ava:157: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatWriter.j
ava:40: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatWriter.j
ava:48: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\aztec\AztecReader.j
ava:52: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\aztec\AztecReader.j
ava:57: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\aztec\AztecReader.j
ava:89: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\DataMatr
ixReader.java:57: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\DataMatr
ixReader.java:62: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\DataMatr
ixReader.java:89: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\detector
\Detector.java:444: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\maxicode\MaxiCodeRe
ader.java:58: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\maxicode\MaxiCodeRe
ader.java:63: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\maxicode\MaxiCodeRe
ader.java:84: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\ByQuadrantRea
der.java:46: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\ByQuadrantRea
der.java:52: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\ByQuadrantRea
der.java:95: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\GenericMultip
leBarcodeReader.java:55: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\GenericMultip
leBarcodeReader.java:60: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeReader
.java:61: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeReader
.java:66: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeReader
.java:93: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\qrcode\QRCode
MultiReader.java:47: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\qrcode\QRCode
MultiReader.java:52: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\detector\Fin
derPatternFinder.java:557: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\detector\Fin
derPatternFinder.java:573: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\qrcode\detect
or\MultiFinderPatternFinder.java:80: method does not override a method from its
superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDReader.jav
a:47: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDReader.jav
a:53: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDReader.jav
a:87: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDimensional
CodeWriter.java:40: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDimensional
CodeWriter.java:53: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\UPCAWriter.jav
a:36: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\UPCAWriter.jav
a:42: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\PDF417Reader
.java:53: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\PDF417Reader
.java:58: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\PDF417Reader
.java:76: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\encoder\PDF4
17Writer.java:32: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\encoder\PDF4
17Writer.java:41: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeWriter
.java:40: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeWriter
.java:47: method does not override a method from its superclass
[javac] @Override
[javac] ^
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 42 errors
BUILD FAILED
D:\ZXing-2.0\zxing-2.0\core\build.xml:37: Compile failed; see the compiler error
output for details.
由于
答案 0 :(得分:3)
这是Java 5 javac无法解析的Java 6语法。
安装并使用具有Java 6 javac的Java 6 JDK。
(如果你不能这样做,你可以尝试使用Eclipse编译器,它可以使用Java 5 JVM编译Java 6源代码 - http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/tasks/task-ant_javac_adapter.htm - 你还需要下载适当版本的ecj.jar)
答案 1 :(得分:2)
您必须使用javac版本6,其中包含选项-source 6
和-target 5
!另请参阅this question。
更新:删除使用-source
版本6
javac
选项
> javac -version
javac 1.6.0_22
> javac -target 5 ...
答案 2 :(得分:0)
它适用于zxing-2.1。我做了以下更改:
的build.xml:
<target name="build" depends="init">
<mkdir dir="build"/>
<javac srcdir="src"
destdir="build"
source="5"
target="5"
的pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>5</source>
<target>5</target>
</configuration>
</plugin>
并且能够编译(mvn clean package)core&amp;没有问题的javase。