linux环境下编译不成功

[hadoop@hd2-single 01]$ javac -cp *.jar zxing_test/Test.java 
zxing_test/Test.java:12: package com.google.zxing.client.j2se does not exist
import com.google.zxing.client.j2se.*;
^
warning: com/google/zxing/BarcodeFormat.class(com/google/zxing:BarcodeFormat.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/BinaryBitmap.class(com/google/zxing:BinaryBitmap.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/DecodeHintType.class(com/google/zxing ecodeHintType.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/LuminanceSource.class(com/google/zxing:LuminanceSource.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/MultiFormatReader.class(com/google/zxing:MultiFormatReader.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/MultiFormatWriter.class(com/google/zxing:MultiFormatWriter.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/Reader.class(com/google/zxing:Reader.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/ReaderException.class(com/google/zxing:ReaderException.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/Result.class(com/google/zxing:Result.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/common/BitMatrix.class(com/google/zxing/common:BitMatrix.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/common/HybridBinarizer.class(com/google/zxing/common:HybridBinarizer.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
error: Class names, 'javase.jar', are only accepted if annotation processing is explicitly requested
zxing_test/Test.java:38: cannot find symbol
symbol  : variable MatrixToImageWriter
location: class zxing_test.Test
            MatrixToImageWriter.writeToFile(byteMatrix, "png", file);  
            ^
zxing_test/Test.java:57: cannot find symbol
symbol  : class BufferedImageLuminanceSource
location: class zxing_test.Test
                        LuminanceSource source = new BufferedImageLuminanceSource(image);  
                                                     ^
warning: com/google/zxing/common/GlobalHistogramBinarizer.class(com/google/zxing/common:GlobalHistogramBinarizer.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/zxing/Binarizer.class(com/google/zxing:Binarizer.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
Note: zxing_test/Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
13 warnings
[hadoop@hd2-single 01]$ ls
com  core.jar  javase.jar  META-INF  zxing_test  zxing_test.compiled.zip  zxing_test.jars.zip  zxing_test.src.zip
[hadoop@hd2-single 01]$ 

我在linux环境下怎么就是编译不成功啊?

编码问题我已经在努力克服了,转utf-8,unicode都试了,无BOM也试了啊。



结果发现:

linux下注意几点:
jdk版本一定要1.7以上,我是1.8.05;
一定要加上 -cp 参数和当前路径;
===我的操作结果如下:
[hadoop@hd2-single 01]$ java -cp *.jar:. zxing_test.Test
java -cp core.jar;javase.jar;zxing_test.jar Test param1 param2
        param1: 二维码图片需要包含的文字信息
        param2: 二维码图片输出路径
[hadoop@hd2-single 01]$ ls
a.png  com  core.jar  javase.jar  META-INF  zxing_test  zxing_test.compiled.zip  zxing_test.jar  zxing_test.jars.zip  zxing_test.src.zip
[hadoop@hd2-single 01]$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
[hadoop@hd2-single 01]$ java -cp *.jar:. zxing_test.Test aaaaaaaaaaaaaaaaaaaaaaaaaaaa a.png
成功生成二维码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值