【ERROR】[1,1] 非法字符:'\ufeff' 和 [1, 10]需要class, interface或enum 解决办法

【ERROR】[1,1] 非法字符:'\ufeff' 和 [1, 10]需要class, interface或enum 解决办法

先解决[Warning] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!

在pom.xml文件中添加 UTF-8 的编码配置即可

【ERROR】[1,1] 非法字符:'\ufeff' 和 [1, 10]需要class, interface或enum 解决办法

再解决[ERROR]

【ERROR】[1,1] 非法字符:'\ufeff' 和 [1, 10]需要class, interface或enum 解决办法其实依旧是UTF-8编码问题。比如可能是你之前这个文件是用GBK写的,后来复制到utf-8环境里编译,而文件里有些是隐藏的字符,很难找出来的。

解决办法。在Notepad++或者Sublime Text中将编码格式设置为UTF-8,再把代码复制进去,保存即可。