Path file=new File(“d:/code/img.png”).toPath();寫完后顯示沒有Path這個包
為什么我的Path file=new File(“d:/code/img.png”).toPath();這句話報錯呢?一寫完Path下面就出現紅色下劃線,顯示壓根就沒有這個包,但我前面那些步驟都和老師視頻里寫的一樣,都沒報錯,就這一句會報錯,這是為啥???
為什么我的Path file=new File(“d:/code/img.png”).toPath();這句話報錯呢?一寫完Path下面就出現紅色下劃線,顯示壓根就沒有這個包,但我前面那些步驟都和老師視頻里寫的一樣,都沒報錯,就這一句會報錯,這是為啥???
2017-07-21
舉報
2018-11-17
直接用File就好了,不需要Path
2018-03-12
jdk使用1.8依然如此
2017-12-14
JDK問題
2017-12-08
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?=?"www.xianlaiwan.cn"; ????????//?定義二維碼參數 ????????HashMap?hints?=?new?HashMap(); ????????//?編碼設置 ????????hints.put(EncodeHintType.CHARACTER_SET,?"utf-8"); ????????//??識別級別 ????????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(); ????????} ????} }2017-11-19
Path file = new File("D:/Qrcode-zxing.png").toPath();我也是 File和topath()下面一直有紅線
2017-09-15
JDK版本太低了,換個1.8的
2017-07-22
因為你d盤下沒有創建code這個文件夾