教學視頻中的D盤下已經新建好了code文件夾,如果自己沒有建立文件夾,可以將try代碼塊中的代碼更改為
File file = new File("D:/code/img.png");
if(!file.exists()){
//不存在改文件夾則創(chuàng)建
file.mkdirs();
}
MatrixToImageWriter.writeToPath(bitMatrix, format, file.toPath());
File file = new File("D:/code/img.png");
if(!file.exists()){
//不存在改文件夾則創(chuàng)建
file.mkdirs();
}
MatrixToImageWriter.writeToPath(bitMatrix, format, file.toPath());
2018-10-24
最贊回答 / Qgfzzzzzz
改為泛型Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
2018-10-21
最贊回答 / allenwhm
上一個回答者File類大小寫誤打了,還有可以檢查一下導入的包是不是對的。Path file = new File("D:/download/qrcode/img.png").toPath();
import?java.io.File; import?java.nio.file.Path;
2018-08-23