[ERROR] /D:/IDEA 文件 /travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,1] 非法字符: '\ufeff'

本贴最后更新于 1670 天前,其中的信息可能已经渤澥桑田

报错信息:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project travel: Compilation failure: Compilation failure: [ERROR] /D:/IDEA 文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,1] 非法字符: '\ufeff' [ERROR] /D:/IDEA 文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,10] 需要 class, interface 或 enum [ERROR] -> Help 1 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. ERROR For more information about the errors and possible solutions, please read the following articles:

jdk 的 pom.xml:

org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 UTF-8

判断:

该文件 D:/IDEA 文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java 的编码错误。

处理:

用 notepad++ 打开 MailUtils.java 文件,查看编码发现:

编码为 utf-8-bom。用 notepad++ 修改编码为 utf-8 并保存:

问题解决。

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...