第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

找不到實體類啊

我表示找不到這個類 MatrixToImageWritoter ? ?我的jar包里沒有?還是要單獨(dú)導(dǎo)入一個實體類?網(wǎng)上的實體類又沒有topath的方法...... 求助

正在回答

2 回答

還需要導(dǎo)入那個jar包啊?。?/p>

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕粉3333056

com.google.zxing.client.j2se這個包
2017-03-25 回復(fù) 有任何疑惑可以回復(fù)我~

你是jar包沒有導(dǎo)入成功吧 我按著老師做的 沒有問題


這個是我寫的 你可以看看是不是這樣

package?com.imooc.zxing;

import?com.google.zxing.*;
import?com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import?com.google.zxing.client.j2se.MatrixToImageWriter;
import?com.google.zxing.common.BitMatrix;
import?com.google.zxing.common.HybridBinarizer;
import?com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;

import?javax.imageio.ImageIO;
import?java.awt.image.BufferedImage;
import?java.io.File;
import?java.nio.file.Path;
import?java.util.HashMap;

/**
?*?生成二維碼
?*/
public?class?CreateQRCode?{
????public?static?void?main(String[]?args)?{
????????createQRCode();
//????????readQRCode();
????}

????private?static?void?readQRCode()?{
????????try?{
????????????MultiFormatReader?formatReader?=?new?MultiFormatReader();
????????????File?file?=?new?File("e:/image.png");
????????????BufferedImage?image?=?null;
????????????image?=?ImageIO.read(file);
????????????HashMap?hashMap?=?new?HashMap();
????????????hashMap.put(EncodeHintType.CHARACTER_SET,?"utf-8");
????????????BinaryBitmap?binaryBitmap?=?new?BinaryBitmap(new?HybridBinarizer(new?BufferedImageLuminanceSource(image)));
????????????Result?result?=?formatReader.decode(binaryBitmap,?hashMap);
????????????System.out.println("解析結(jié)果:"+result.toString());
????????????System.out.println("二維碼格式類型:"+result.getBarcodeFormat());
????????????System.out.println("二維碼文本:"+result.getText());

????????}?catch?(Exception?e)?{
????????????e.printStackTrace();
????????}
????}

????private?static?void?createQRCode()?{
????????int?width?=?300;
????????int?height?=?300;
????????String?format?=?"png";
????????String?content?=?"www.baidu.com";

????????//定義二維碼的參數(shù)
????????HashMap?hashMap?=?new?HashMap();
????????hashMap.put(EncodeHintType.CHARACTER_SET,?"utf-8");
????????hashMap.put(EncodeHintType.ERROR_CORRECTION,?ErrorCorrectionLevel.M);
????????hashMap.put(EncodeHintType.MARGIN,?5);

????????try?{
????????????BitMatrix?bitMatrix?=?new?MultiFormatWriter().encode(content,?BarcodeFormat.QR_CODE,?width,?height);
????????????Path?file?=?new?File("e:/img.png").toPath();
????????????MatrixToImageWriter.writeToPath(bitMatrix,?format,?file);
????????}?catch?(Exception?e)?{
????????????e.printStackTrace();
????????}
????}
}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

angle_xin 提問者

謝謝拉 我發(fā)現(xiàn)依賴個包 我又導(dǎo)入了一個jar包 就有這個類了
2016-08-24 回復(fù) 有任何疑惑可以回復(fù)我~
#2

慕前端8116659 回復(fù) angle_xin 提問者

也遇到同樣的問題了
2017-09-17 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
Java生成二維碼
  • 參與學(xué)習(xí)       84566    人
  • 解答問題       279    個

二維碼無處不在,自己動手用Java生成二維碼,三種生成方式任你選

進(jìn)入課程

找不到實體類啊

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號