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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

Path file=new File(“d:/code/img.png”).toPath();寫(xiě)完后顯示沒(méi)有Path這個(gè)包

為什么我的Path file=new File(“d:/code/img.png”).toPath();這句話(huà)報(bào)錯(cuò)呢?一寫(xiě)完P(guān)ath下面就出現(xiàn)紅色下劃線(xiàn),顯示壓根就沒(méi)有這個(gè)包,但我前面那些步驟都和老師視頻里寫(xiě)的一樣,都沒(méi)報(bào)錯(cuò),就這一句會(huì)報(bào)錯(cuò),這是為啥啊?

正在回答

7 回答

直接用File就好了,不需要Path

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

jdk使用1.8依然如此

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

JDK問(wèn)題

0 回復(fù) 有任何疑惑可以回復(fù)我~
package?com;
import?java.nio.file.Path;
import?java.util.HashMap;
import?com.google.zxing.BarcodeFormat;
import?com.google.zxing.EncodeHintType?;
import?com.google.zxing.MultiFormatReader;
import?com.google.zxing.MultiFormatWriter;
import?com.google.zxing.client.j2se.MatrixToImageWriter;
import?com.google.zxing.common.BitMatrix;
import?com.google.zxing.pdf417.decoder.ec.ErrorCorrection;
import?com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import?java.io.File;

public?class?QRcode?{
????public?static?void?main(String[]?args)?{
????????int?width?=?300;
????????int?height?=?300;
????????String?format?=?"png";
????????String?content?=?"idcbgp.cn";

????????//?定義二維碼參數(shù)
????????HashMap?hints?=?new?HashMap();
????????//?編碼設(shè)置
????????hints.put(EncodeHintType.CHARACTER_SET,?"utf-8");
????????//??識(shí)別級(jí)別
????????hints.put(EncodeHintType.ERROR_CORRECTION,?ErrorCorrectionLevel.M);
????????//?邊距
????????hints.put(EncodeHintType.MARGIN,?2);

????????try{
????????????BitMatrix?bitMatrix?=??new?MultiFormatWriter().encode(content,?BarcodeFormat.QR_CODE,?width,?height,?hints);
????????????Path?file?=?new?File("./Qrcode.png").toPath();
????????????MatrixToImageWriter.writeToPath(bitMatrix,?format,?file?);

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


????}
}


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

創(chuàng)心

路徑是 mac 寫(xiě)的, 。windows 請(qǐng)看老師具體修改
2017-12-08 回復(fù) 有任何疑惑可以回復(fù)我~

Path file = new File("D:/Qrcode-zxing.png").toPath();我也是 File和topath()下面一直有紅線(xiàn)

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

JDK版本太低了,換個(gè)1.8的

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

因?yàn)槟鉪盤(pán)下沒(méi)有創(chuàng)建code這個(gè)文件夾


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

慕粉2049205449 提問(wèn)者

不是啊,我在d盤(pán)下建了code這個(gè)文件夾,報(bào)錯(cuò)還是老樣子
2017-07-25 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Imooc_YunLong 回復(fù) 慕粉2049205449 提問(wèn)者

這個(gè)問(wèn)題你解決了沒(méi)
2017-11-15 回復(fù) 有任何疑惑可以回復(fù)我~
#3

慕粉2242270 回復(fù) 慕粉2049205449 提問(wèn)者

想知道怎么解決的
2018-08-04 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

Path file=new File(“d:/code/img.png”).toPath();寫(xiě)完后顯示沒(méi)有Path這個(gè)包

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

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

幫助反饋 APP下載

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

公眾號(hào)

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