为了账号安全,请及时绑定邮箱和手机立即绑定

二维码 Path 和Topath ➕斜杆的 有问题

二维码 Path 和Topath ➕斜杆的 有问题

qq_一袭狗屎香_0 2017-07-17 09:46:38
public static void main(String[] args) {int width = 300;int height = 300;String format = "png";String content = "www.imaac.com";//定义二维码的参数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);Path file = new File("D:/img.png").toPath();MatrixToImageWriter.writeToPath(bitMatrix, format, file);} catch (Exception e) {e.printStackTrace();}}下斜杠Path和toPath()处有红线报错
查看完整描述

2 回答

?
Camel97

TA贡献49条经验 获得超38个赞

你有导入包含Path类的包吗。

查看完整回答
反对 回复 2017-07-17
  • 2 回答
  • 0 关注
  • 1047 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信